Comments (5)
Kia Ora!
I had some time to work on this. According to https://redis.io/commands/eval we can't get system time in Lua script itself:
In order to enforce this behavior in scripts Redis does the following:
Lua does not export commands to access the system time or other external state.
Redis will block the script with an error if a script calls a Redis command able to alter the data set after a Redis random command like RANDOMKEY, SRANDMEMBER, TIME. This means that if a script is read-only and does not modify the data set it is free to call those commands. Note that a random command does not necessarily mean a command that uses random numbers: any non-deterministic command is considered a random command (the best example in this regard is the TIME command).
127.0.0.1:6379> eval "local t = redis.call('TIME'); redis.call('LPUSH', 'test_queue', t[1]); return t[1]" 0
(error) ERR Error running script (call to f_23907c1ac8a9f92f2e36a750baa9b1ac885dc9d6): @user_script:1: @user_script: 1: Write commands not allowed after non deterministic commands
So it have to be passed to the script as argument, which is already done anyway - it's used for the sorted set score.
I did not want to make the script aware for the the difference between the retry and schedule sets, so we can either change it to set enqueued_at for all jobs that don't have this already (assuming these will be coming only from the schedule set), which I did in https://github.com/krasio/verk/tree/issues/109 or we can change the ScheduleManager to pass additional param when handling fetch_scheduled
- https://github.com/krasio/verk/tree/issues/109-2.
The downside of the former approach is that after upgrade all jobs from the retry set will get their enqueued_at set to the time they were retried first time after upgrade.
Let me know what do you think and I'll send a pull request.
from verk.
Hey @krasio! I think it's fine. Can you set up a PR? Sorry for the delay
from verk.
Which one of the approaches will you prefer?
from verk.
Oops sorry I forgot to specify which one. I would simply populate enqueued_at
when the data is missing. The downside is that people upgrading will see a wrong enqueued_at
when there's a retry but after some time it will be fine. What do you reckon?
from verk.
I'm fine with that, will submit PR soon.
from verk.
Related Issues (20)
- Strange behaviour with integer argument, potential bug HOT 17
- Add mix task to reset queues HOT 9
- Add pending jobs to queue stats HOT 2
- Unable to overwrite `max_retry_count` via config.exs HOT 2
- Event for dead job HOT 2
- Question. Can Verk check more frequently for new jobs? HOT 2
- Undocumented `max_dead_jobs` HOT 1
- function Verk.Supervisor.start_link/1 is undefined or private HOT 3
- Im surely missing something. HOT 4
- Coupling of producers and consumers? HOT 1
- Upgrade GenStage to current version HOT 5
- Version Conflict with Confex 3.4.0 HOT 2
- Loosen dependency on redis HOT 2
- Verk 2.0 HOT 12
- Skip queuing jobs during tests. HOT 1
- Batch processing? HOT 2
- Defining contextual data for worker processes HOT 4
- [question] What are the risks of the "experimental" generate_node_id feature? HOT 4
- How do I setup Verk as a producer only? HOT 1
- Connect to Redix via ipv6? 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 verk.