summaryrefslogtreecommitdiff
path: root/vendor/codeberg.org/gruf/go-sched/job.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2022-07-22 11:43:34 +0100
committerLibravatar GitHub <noreply@github.com>2022-07-22 12:43:34 +0200
commitd20ec967c429e1bc0314aff03c70079cca6a0e56 (patch)
tree24581d4b3119851324e73577f03c5583de5b5383 /vendor/codeberg.org/gruf/go-sched/job.go
parent[chore] Update image/video size defaults to mastodon's (#723) (diff)
downloadgotosocial-d20ec967c429e1bc0314aff03c70079cca6a0e56.tar.xz
[bugfix] update go-cache library to fix critical bug during cache sweep scheduling (#725)
* update go-cache library to fix critical bug regarding cache sweep scheduling Signed-off-by: kim <grufwub@gmail.com> * update go-sched Signed-off-by: kim <grufwub@gmail.com>
Diffstat (limited to 'vendor/codeberg.org/gruf/go-sched/job.go')
-rw-r--r--vendor/codeberg.org/gruf/go-sched/job.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/vendor/codeberg.org/gruf/go-sched/job.go b/vendor/codeberg.org/gruf/go-sched/job.go
index 66e24fe9a..7831a39bd 100644
--- a/vendor/codeberg.org/gruf/go-sched/job.go
+++ b/vendor/codeberg.org/gruf/go-sched/job.go
@@ -1,6 +1,9 @@
package sched
import (
+ "reflect"
+ "strconv"
+ "strings"
"time"
"codeberg.org/gruf/go-atomics"
@@ -97,3 +100,19 @@ func (job *Job) Run(now time.Time) {
}()
job.call(now)
}
+
+// String provides a debuggable string representation of Job including ID, next time and Timing type.
+func (job *Job) String() string {
+ var buf strings.Builder
+ buf.WriteByte('{')
+ buf.WriteString("id=")
+ buf.WriteString(strconv.FormatUint(job.id, 10))
+ buf.WriteByte(' ')
+ buf.WriteString("next=")
+ buf.WriteString(job.next.Load().Format(time.StampMicro))
+ buf.WriteByte(' ')
+ buf.WriteString("timing=")
+ buf.WriteString(reflect.TypeOf(job.timing).String())
+ buf.WriteByte('}')
+ return buf.String()
+}