acaloiaro / neoq

Queue-agnostic background job library for Go, with a pleasant API and powerful features.
MIT License
270 stars 4 forks source link

Make interval of time for which jobs are dedicated a goroutine configurable in P... #19

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 1 year ago

https://github.com/acaloiaro/neoq/blob/a024be6a3953a1512a1accee11bd296e6869c338/postgres_backend.go#L610


    w.initFutureJobs(ctx, queue)

    // check for new future jobs on an interval
    // TODO Make the future jobs check interval configurable in PgBackend
    ticker := time.NewTicker(5 * time.Second)

    for {
        // loop over list of future jobs, scheduling goroutines to wait for jobs that are due within the next 30 seconds
        // TODO Make interval of time for which jobs are dedicated a goroutine configurable in PgBackend
        for jobID, runAfter := range w.futureJobs {
            at := time.Until(runAfter)
            if at <= time.Duration(30*time.Second) {