Comments (4)
Line 62 in 17fd835
this will stop the command after deadline is exceeded. do you mean supporting context in handler?
from work.
You are correct, missed that part when reading the code.
However, it is confusing because I assume that the worker will take care of the context's deadline because that is what the job option MaxExecutionTime
implies, no? Aka the job has max execution time.
What do you think about following logic instead:
- after job has been dequeued and if job's
MaxExecutionTime
is not nil and greater than 0, then create timeout context with the option's duration value in the worker's loop - call handle
- if context's
<-ctx.Done()
gets triggered before handle returns, then that job must be cancelled and retried with backoff
In that way, you do not have to define context.WithTimeout
in job.
from work.
cancellation requires subfunctions to respect context timeout, and exit themselves, so we cannot do exactly what you said. but we could change the handler function signature to support it in the next major version.
from work.
done in #41
from work.
Related Issues (20)
- Is UI similar to Web UI in gocraft/work upcoming? HOT 3
- Unique EnqueueMiddleware example HOT 2
- Catch Panic Middleware HOT 1
- Worker loop is a busy loop HOT 1
- Is this abandoned? HOT 6
- support "job group" like sidekiq batch
- [QUESTION] Does the reaper still exist? HOT 1
- [QUESTION] How to assign priority to job/task HOT 1
- [REQUEST] Create a new release HOT 1
- custom ratelimit middleware HOT 1
- Latest master version has no tag HOT 1
- Ability to retry dead jobs manually HOT 3
- Update github.com/go-redis/redis/v7 to v8 HOT 2
- Merge this into gocraft/work HOT 4
- Lost job HOT 6
- Is it still in prototype stage? HOT 4
- Seeing jobs dequeued/run multiple times for long-running cron jobs, despite same jobId/start time HOT 3
- ContextJobFunc and HeartbeatMiddleware incompatible? HOT 5
- Backward compatibility w/ work v1 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from work.