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 the future jobs check interval configurable in MemBackend #11

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 1 year ago

https://github.com/acaloiaro/neoq/blob/a024be6a3953a1512a1accee11bd296e6869c338/memory_backend.go#L234


func (m *MemBackend) scheduleFutureJobs(ctx context.Context, queue string) {
    // check for new future jobs on an interval
    // TODO make the future jobs check interval configurable in MemBackend
    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 MemBackend
        m.futureJobs.Range(func(k, v any) bool {
            job := v.(Job)
            var queueChan chan Job