sidequestjs / sidequestjs/sidequest

Add support for transactional job enqueuing

Open
#149 6 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

design mismatch
Dominant language
TypeScript
Stars
1k
Forks
25
Avg merge
12h 17m
Merged PRs (30d)
5

Description

Hello there,

For my current project, I am looking for a solution like Sidequest.js for handling async jobs using my existing PostgreSQL database.

What is preventing me from using Sidequest.js is that I need the enqueued jobs to be committed in the same transaction as my business logic.

In my experience, this pattern provides multiple benefits:

  1. It avoids race conditions that can happen when the job is being processed right after being enqueued, while your business entities might have not been committed yet
  2. For bigger workflows with multiple jobs being enqueued in a single request, any error happening after enqueuing jobs will trigger a rollback, which avoids jobs being processed multiple times when the system retries the operation

I could write my own query to enqueue the job and be done with it, but I deeply think Sidequest should provide this feature to its users and help them make their system more robust. IMO, the main advantage of using your current DB as a message broker is to keep your data and workflows strongly consistent.

I'd love to implement this change if it fits Sidequest.js vision. 😊

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or specific entry points. Start by locating Sidequest.js's job-enqueue path and database transaction handling, then determine how callers would share a transaction with business logic. Done means jobs and related business changes commit or roll back together, with tests covering both outcomes.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, postgresql, typescript
Domain
backend, databases, distributed-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.