GithubHelp home page GithubHelp logo

Comments (10)

ghosx avatar ghosx commented on September 26, 2024

Do you have reproducible code and screenshots?

from asynq.

naisev avatar naisev commented on September 26, 2024

I have same problem.

from asynq.

hibiken avatar hibiken commented on September 26, 2024

@xmwilldo thanks for reporting an issue.

Did you specify your timezone via SchedulerOpts.Location?

If so, would you mind providing some code snippets to help me investigate further?

from asynq.

xmwilldo avatar xmwilldo commented on September 26, 2024

@hibiken Yes, I tried but it didn't work.

loc, _ := time.LoadLocation("Asia/Shanghai")
	mgr, err := asynq.NewPeriodicTaskManager(
		asynq.PeriodicTaskManagerOpts{
			PeriodicTaskConfigProvider: &TrainPeriodicTaskProvider{
				ctx:    l.ctx,
				svcCtx: l.svcCtx,
			},
			RedisConnOpt: asynq.RedisClientOpt{
				Addr:     l.svcCtx.Config.Redis.Host,
				Password: l.svcCtx.Config.Redis.Pass,
				DB:       10,
			},
			SchedulerOpts: &asynq.SchedulerOpts{
				Location: loc,
			},
			SyncInterval: 10 * time.Second,
		},
	)
	if err != nil {
		log.Fatalf("could new PeriodicTaskManager: %v", err)
	}

from asynq.

xmwilldo avatar xmwilldo commented on September 26, 2024

uTools_1688435614105
I have these scheduled tasks, each task executes at least ten sub-tasks, but the statistical results are as follows:
uTools_1688435992847

from asynq.

hibiken avatar hibiken commented on September 26, 2024

It's probably related to this one? hibiken/asynqmon#295

UI shows everything in UTC so I think we need to open a FR to support different timezone in the UI.

from asynq.

xmwilldo avatar xmwilldo commented on September 26, 2024

This doesn't seem to matter, because the ui just shows the data in redis, and the data recorded in redis itself is wrong

from asynq.

xmwilldo avatar xmwilldo commented on September 26, 2024

uTools_1688454744529
like this

from asynq.

hibiken avatar hibiken commented on September 26, 2024

I see.
We need to update these helpers to be timezone aware (currently always use UTC):

asynq/internal/base/base.go

Lines 169 to 172 in fde294b

// ProcessedKey returns a redis key for processed count for the given day for the queue.
func ProcessedKey(qname string, t time.Time) string {
return fmt.Sprintf("%sprocessed:%s", QueueKeyPrefix(qname), t.UTC().Format("2006-01-02"))
}

asynq/internal/base/base.go

Lines 174 to 177 in fde294b

// FailedKey returns a redis key for failure count for the given day for the queue.
func FailedKey(qname string, t time.Time) string {
return fmt.Sprintf("%sfailed:%s", QueueKeyPrefix(qname), t.UTC().Format("2006-01-02"))
}

This may be a good first issue for someone's who's looking to contribute.

from asynq.

xmwilldo avatar xmwilldo commented on September 26, 2024

I would also like to participate, but this PR#683 already exists. Thanks!

from asynq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.