Skip to content

Commit 0b90d33

Browse files
authored
Fix the bug that causes scheduled task not running (#18)
Fix #17
1 parent 2746ffb commit 0b90d33

File tree

3 files changed

+19
-98
lines changed

3 files changed

+19
-98
lines changed

.circleci/config.yml

Lines changed: 2 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ orbs:
44
codecov: codecov/codecov@3.1.1
55

66
jobs:
7-
build118:
7+
build:
88
docker:
99
- image: cimg/go:1.18
1010
steps:
@@ -23,102 +23,7 @@ jobs:
2323
name: Run tests
2424
command: go test -coverprofile=coverage.txt -covermode=atomic
2525
- codecov/upload
26-
build117:
27-
docker:
28-
- image: cimg/go:1.17
29-
steps:
30-
- checkout
31-
- restore_cache:
32-
keys:
33-
- go-mod-v4-{{ checksum "go.sum" }}
34-
- run:
35-
name: Install Dependencies
36-
command: go get -t -v ./...
37-
- save_cache:
38-
key: go-mod-v4-{{ checksum "go.sum" }}
39-
paths:
40-
- "/go/pkg/mod"
41-
- run:
42-
name: Run tests
43-
command: go test -coverprofile=coverage.txt -covermode=atomic
44-
build116:
45-
docker:
46-
- image: cimg/go:1.16
47-
steps:
48-
- checkout
49-
- restore_cache:
50-
keys:
51-
- go-mod-v4-{{ checksum "go.sum" }}
52-
- run:
53-
name: Install Dependencies
54-
command: go get -t -v ./...
55-
- save_cache:
56-
key: go-mod-v4-{{ checksum "go.sum" }}
57-
paths:
58-
- "/go/pkg/mod"
59-
- run:
60-
name: Run tests
61-
command: go test -coverprofile=coverage.txt -covermode=atomic
62-
build115:
63-
docker:
64-
- image: cimg/go:1.15
65-
steps:
66-
- checkout
67-
- restore_cache:
68-
keys:
69-
- go-mod-v4-{{ checksum "go.sum" }}
70-
- run:
71-
name: Install Dependencies
72-
command: go get -t -v ./...
73-
- save_cache:
74-
key: go-mod-v4-{{ checksum "go.sum" }}
75-
paths:
76-
- "/go/pkg/mod"
77-
- run:
78-
name: Run tests
79-
command: go test -coverprofile=coverage.txt -covermode=atomic
80-
build114:
81-
docker:
82-
- image: cimg/go:1.14
83-
steps:
84-
- checkout
85-
- restore_cache:
86-
keys:
87-
- go-mod-v4-{{ checksum "go.sum" }}
88-
- run:
89-
name: Install Dependencies
90-
command: go get -t -v ./...
91-
- save_cache:
92-
key: go-mod-v4-{{ checksum "go.sum" }}
93-
paths:
94-
- "/go/pkg/mod"
95-
- run:
96-
name: Run tests
97-
command: go test -coverprofile=coverage.txt -covermode=atomic
98-
build113:
99-
docker:
100-
- image: cimg/go:1.13
101-
steps:
102-
- checkout
103-
- restore_cache:
104-
keys:
105-
- go-mod-v4-{{ checksum "go.sum" }}
106-
- run:
107-
name: Install Dependencies
108-
command: go get -t -v ./...
109-
- save_cache:
110-
key: go-mod-v4-{{ checksum "go.sum" }}
111-
paths:
112-
- "/go/pkg/mod"
113-
- run:
114-
name: Run tests
115-
command: go test -coverprofile=coverage.txt -covermode=atomic
11626
workflows:
11727
build-workflow:
11828
jobs:
119-
- build118
120-
- build117
121-
- build116
122-
- build115
123-
- build114
124-
- build113
29+
- build

go.sum

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
12
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
24
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
5+
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
36
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
7+
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
48
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
59
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
10+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
611
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

trigger.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,17 @@ func (trigger *CronTrigger) NextExecutionTime(ctx TriggerContext) time.Time {
7979
}
8080

8181
originalLocation := now.Location()
82-
next := trigger.cronExpression.NextTime(now.In(trigger.location))
82+
83+
convertedTime := now.In(trigger.location)
84+
newTime := time.Date(convertedTime.Year(),
85+
convertedTime.Month(),
86+
convertedTime.Day(),
87+
convertedTime.Hour(),
88+
convertedTime.Minute(),
89+
convertedTime.Second(),
90+
0,
91+
trigger.location)
92+
93+
next := trigger.cronExpression.NextTime(newTime)
8394
return next.In(originalLocation)
8495
}

0 commit comments

Comments
 (0)