Comments (3)
Thank you for the PR @mrputty . It seems absolutely fine. In fact, in another place (unrelated to odd-jobs) where we are using LISTEN/NOTIFY for larger payloads, even we have faced this issue.
Just curious, what kind of large payloads are you putting in the job queue? Usually, we end-up putting the PK of another row in the DB as the job-payload (where the target row may be very large, not the job-payload itself).
Nevertheless, this optimization is good-to-have. I will merge it after compiling locally once.
from odd-jobs.
Great, glad to hear this will be merged.
My use case involves using odd-jobs to orchestrate the retrieval of individual items from a large data set. Within each item there are different subsets of data that may or may not need to be retrieved. The job-payload consists primarily of a list of item ids, tagged with the subsets that need to be retrieved. Some of these requests may include thousands of items, and we would quickly run into the 8000 byte limit, but we don't think they'll ever be terribly large.
Because the set of items to be retrieved does not have any meaning outside of the request, it seems to me that the overhead of maintaining them is in a secondary table is unnecessary, and also potentially difficult. For example, managing the lifetime of rows in the secondary table seems complicated. If one of these jobs fails, we would have to remember to delete the corresponding row (whose id would be embedded in the JSON job payload) when we were cleaning up the failed job records.
As I thought through managing this, I realized that there's also no way for me to enforce guarantees about record lifetimes even during normal processing. For example, if I were to write code to delete the secondary record at the end of job execution in my code, I have no way to guarantee that some other exception doesn't occur after the delete but before odd-jobs actually finalized the job. Since neither job runner nor any onJobStart
callback have access to the underlying database connection, this cannot be done in a transaction.
Thinking about that was enough to encourage me to look for a simpler solution, which lead me to how pg_notify
was being used.
from odd-jobs.
@mrputty would you like to close and re-open a fresh MR, if you care about Hacktoberfest? Else I'll merge this one.
from odd-jobs.
Related Issues (20)
- Use prepared-statements and bind-params for SQL statements where appropriate
- Need help in using JobErrHandler HOT 3
- Some job callbacks are not used HOT 2
- Add priority to jobs?
- Recommend users fork jobs with Async HOT 1
- Odd jobs create table fails with exception if table already exists. HOT 1
- Support for custom URL roots HOT 3
- Release a new version HOT 6
- Jobs which time out never hit the attempt limit HOT 5
- Test case: Sorting based on job attempts HOT 3
- Add logging for when jobs get canceled due to time out
- add ```created_by``` column to the job table HOT 1
- Why delete ```success``` jobs? HOT 1
- Support `aeson-2.*` HOT 1
- Failed to build odd-jobs-0.2.2 (type error)
- `cancelJobIO` doesn't work HOT 1
- Backlog: Write test-case for job-deletion configuration option HOT 1
- Make job deletion configurable HOT 5
- Perf: Use PREPARE/EXECUTE for various PG queries
- Use SKIP LOCKED when polling for new jobs? 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 odd-jobs.