summaryrefslogtreecommitdiff
path: root/vendor/codeberg.org/gruf/go-sched/timing.go
diff options
context:
space:
mode:
authorLibravatar kim <grufwub@gmail.com>2025-10-17 17:36:24 +0200
committerLibravatar tobi <tobi.smethurst@protonmail.com>2025-11-17 14:11:11 +0100
commitf714b06fec5b93cf076d0f92eeb8aa7c32cfb531 (patch)
tree8e1a89dd7b0db0f17b695557d03eede9055134ae /vendor/codeberg.org/gruf/go-sched/timing.go
parent[bugfix] recheck for just-processed-emoji within mutex lock before starting p... (diff)
downloadgotosocial-f714b06fec5b93cf076d0f92eeb8aa7c32cfb531.tar.xz
[chore] update dependencies (#4507)
- codeberg.org/gruf/go-runners: v1.6.3 -> v1.7.0 - codeberg.org/gruf/go-sched: v1.2.4 -> v1.3.0 - github.com/tdewolff/minify/v2: v2.24.3 -> v2.24.4 Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4507 Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'vendor/codeberg.org/gruf/go-sched/timing.go')
-rw-r--r--vendor/codeberg.org/gruf/go-sched/timing.go25
1 files changed, 16 insertions, 9 deletions
diff --git a/vendor/codeberg.org/gruf/go-sched/timing.go b/vendor/codeberg.org/gruf/go-sched/timing.go
index 33c230fa5..cb9b4925a 100644
--- a/vendor/codeberg.org/gruf/go-sched/timing.go
+++ b/vendor/codeberg.org/gruf/go-sched/timing.go
@@ -5,11 +5,13 @@ import (
)
var (
- // zerotime is zero time.Time (unix epoch).
- zerotime = time.Time{}
+ // zerotime is zero
+ // time.Time (unix epoch).
+ zerotime time.Time
- // emptytiming is a global timingempty to check against.
- emptytiming = timingempty{}
+ // emptytiming is a global
+ // timingempty to check against.
+ emptytiming timingempty
)
// Timing provides scheduling for a Job, determining the next time
@@ -20,14 +22,16 @@ type Timing interface {
Next(time.Time) time.Time
}
-// timingempty is a 'zero' Timing implementation that always returns zero time.
+// timingempty is a 'zero' Timing implementation
+// that always returns zero time.
type timingempty struct{}
func (timingempty) Next(time.Time) time.Time {
return zerotime
}
-// Once implements Timing to provide a run-once Job execution.
+// Once implements Timing to
+// provide a run-once Job execution.
type Once time.Time
func (o *Once) Next(time.Time) time.Time {
@@ -36,14 +40,16 @@ func (o *Once) Next(time.Time) time.Time {
return ret
}
-// Periodic implements Timing to provide a recurring Job execution.
+// Periodic implements Timing to
+// provide a recurring Job execution.
type Periodic time.Duration
func (p Periodic) Next(now time.Time) time.Time {
return now.Add(time.Duration(p))
}
-// PeriodicAt implements Timing to provide a recurring Job execution starting at 'Once' time.
+// PeriodicAt implements Timing to provide a
+// recurring Job execution starting at 'Once' time.
type PeriodicAt struct {
Once Once
Period Periodic
@@ -56,7 +62,8 @@ func (p *PeriodicAt) Next(now time.Time) time.Time {
return p.Period.Next(now)
}
-// TimingWrap allows combining two different Timing implementations.
+// TimingWrap allows combining two
+// different Timing implementations.
type TimingWrap struct {
Outer Timing
Inner Timing