2
0
mirror of https://github.com/hibiken/asynq.git synced 2025-10-26 11:16:12 +08:00

Change UTC timezone to system time

This commit is contained in:
Alexandros Ioannides
2023-07-09 00:55:32 +03:00
parent 123d560a44
commit 020309f472
12 changed files with 33 additions and 33 deletions

View File

@@ -373,7 +373,7 @@ func (r *RDB) HistoricalStats(qname string, n int) ([]*DailyStats, error) {
return nil, errors.E(op, errors.NotFound, &errors.QueueNotFoundError{Queue: qname})
}
const day = 24 * time.Hour
now := r.clock.Now().UTC()
now := r.clock.Now()
var days []time.Time
var keys []string
for i := 0; i < n; i++ {

View File

@@ -343,7 +343,7 @@ func TestCurrentStatsWithNonExistentQueue(t *testing.T) {
func TestHistoricalStats(t *testing.T) {
r := setup(t)
defer r.Close()
now := time.Now().UTC()
now := time.Now()
tests := []struct {
qname string // queue of interest
@@ -5326,7 +5326,7 @@ func TestListWorkers(t *testing.T) {
func TestWriteListClearSchedulerEntries(t *testing.T) {
r := setup(t)
now := time.Now().UTC()
now := time.Now()
schedulerID := "127.0.0.1:9876:abc123"
data := []*base.SchedulerEntry{

View File

@@ -1356,7 +1356,7 @@ func (r *RDB) WriteServerState(info *base.ServerInfo, workers []*base.WorkerInfo
if err != nil {
return errors.E(op, errors.Internal, fmt.Sprintf("cannot encode server info: %v", err))
}
exp := r.clock.Now().Add(ttl).UTC()
exp := r.clock.Now().Add(ttl)
args := []interface{}{ttl.Seconds(), bytes} // args to the lua script
for _, w := range workers {
bytes, err := base.EncodeWorkerInfo(w)
@@ -1421,7 +1421,7 @@ func (r *RDB) WriteSchedulerEntries(schedulerID string, entries []*base.Schedule
}
args = append(args, bytes)
}
exp := r.clock.Now().Add(ttl).UTC()
exp := r.clock.Now().Add(ttl)
key := base.SchedulerEntriesKey(schedulerID)
err := r.client.ZAdd(ctx, base.AllSchedulers, redis.Z{Score: float64(exp.Unix()), Member: key}).Err()
if err != nil {

View File

@@ -2767,7 +2767,7 @@ func TestWriteServerState(t *testing.T) {
Concurrency: 10,
Queues: map[string]int{"default": 2, "email": 5, "low": 1},
StrictPriority: false,
Started: time.Now().UTC(),
Started: time.Now(),
Status: "active",
ActiveWorkerCount: 0,
}
@@ -2857,7 +2857,7 @@ func TestWriteServerStateWithWorkers(t *testing.T) {
Concurrency: 10,
Queues: map[string]int{"default": 2, "email": 5, "low": 1},
StrictPriority: false,
Started: time.Now().Add(-10 * time.Minute).UTC(),
Started: time.Now().Add(-10 * time.Minute),
Status: "active",
ActiveWorkerCount: len(workers),
}