[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>
This commit is contained in:
kim
2022-07-22 11:43:34 +01:00
committed by GitHub
parent 40f91d052c
commit d20ec967c4
6 changed files with 61 additions and 37 deletions

View File

@@ -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()
}