Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
cab981c3
Commit
cab981c3
authored
Oct 11, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: fix linter errors
parent
3370ecd4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
11 deletions
+11
-11
cron.go
internal/cron/cron.go
+6
-6
logger.go
internal/cron/logger.go
+2
-2
parser.go
internal/cron/parser.go
+1
-1
spec.go
internal/cron/spec.go
+2
-2
No files found.
internal/cron/cron.go
View file @
cab981c3
...
...
@@ -185,7 +185,7 @@ func (c *Cron) Entries() []Entry {
return
c
.
entrySnapshot
()
}
// Location gets the time zone location
// Location gets the time zone location
.
func
(
c
*
Cron
)
Location
()
*
time
.
Location
{
return
c
.
location
}
...
...
@@ -219,7 +219,7 @@ func (c *Cron) Start() {
return
}
c
.
running
=
true
go
c
.
run
()
go
c
.
run
Scheduler
()
}
// Run the cron scheduler, or no-op if already running.
...
...
@@ -231,12 +231,12 @@ func (c *Cron) Run() {
}
c
.
running
=
true
c
.
runningMu
.
Unlock
()
c
.
run
()
c
.
run
Scheduler
()
}
// run the scheduler.. this is private just due to the need to synchronize
// run
Scheduler runs
the scheduler.. this is private just due to the need to synchronize
// access to the 'running' state variable.
func
(
c
*
Cron
)
run
()
{
func
(
c
*
Cron
)
run
Scheduler
()
{
c
.
logger
.
Info
(
"start"
)
// Figure out the next activation times for each entry.
...
...
@@ -313,7 +313,7 @@ func (c *Cron) startJob(j Job) {
}()
}
// now returns current time in c location
// now returns current time in c location
.
func
(
c
*
Cron
)
now
()
time
.
Time
{
return
time
.
Now
()
.
In
(
c
.
location
)
}
...
...
internal/cron/logger.go
View file @
cab981c3
...
...
@@ -9,10 +9,10 @@ import (
)
// DefaultLogger is used by Cron if none is specified.
var
DefaultLogger
Logger
=
PrintfLogger
(
log
.
New
(
os
.
Stdout
,
"cron: "
,
log
.
LstdFlags
))
var
DefaultLogger
=
PrintfLogger
(
log
.
New
(
os
.
Stdout
,
"cron: "
,
log
.
LstdFlags
))
// DiscardLogger can be used by callers to discard all log messages.
var
DiscardLogger
Logger
=
PrintfLogger
(
log
.
New
(
io
.
Discard
,
""
,
0
))
var
DiscardLogger
=
PrintfLogger
(
log
.
New
(
io
.
Discard
,
""
,
0
))
// Logger is the interface used in this package for logging, so that any backend
// can be plugged in. It is a subset of the github.com/go-logr/logr interface.
...
...
internal/cron/parser.go
View file @
cab981c3
...
...
@@ -358,7 +358,7 @@ func getBits(min, max, step uint) uint64 {
return
bits
}
// all returns all bits within the given bounds.
(plus the star bit)
// all returns all bits within the given bounds.
func
all
(
r
bounds
)
uint64
{
return
getBits
(
r
.
min
,
r
.
max
,
1
)
|
starBit
}
...
...
internal/cron/spec.go
View file @
cab981c3
...
...
@@ -178,8 +178,8 @@ WRAP:
// restrictions are satisfied by the given time.
func
dayMatches
(
s
*
SpecSchedule
,
t
time
.
Time
)
bool
{
var
(
domMatch
bool
=
1
<<
uint
(
t
.
Day
())
&
s
.
Dom
>
0
dowMatch
bool
=
1
<<
uint
(
t
.
Weekday
())
&
s
.
Dow
>
0
domMatch
=
1
<<
uint
(
t
.
Day
())
&
s
.
Dom
>
0
dowMatch
=
1
<<
uint
(
t
.
Weekday
())
&
s
.
Dow
>
0
)
if
s
.
Dom
&
starBit
>
0
||
s
.
Dow
&
starBit
>
0
{
return
domMatch
&&
dowMatch
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment