Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there an escape hatch for the wrapping transaction? #93

Open
ahacop opened this issue Aug 21, 2024 · 0 comments
Open

Is there an escape hatch for the wrapping transaction? #93

ahacop opened this issue Aug 21, 2024 · 0 comments

Comments

@ahacop
Copy link

ahacop commented Aug 21, 2024

Question: Is it possible to run a step (or await on a job) that is not run inside the "acidic" transaction.

Use case: Let's say we want to fetch a collection of items from an API, process each item, then persist the processed items. The collection feature in AcidicJob can do this, but let's say an additional requirement is that we don't want to persist the collection to a database record.

Let's also assume that processing is expensive, so while we don't mind fetching from the API on retry, we don't want to reprocess items on retry.

One way we could handle this is with an idempotent job that: 1) fetches the collection; 2) checks the db to see which processed items exist; 3) only processes the unprocessed items from the collection (persisting immediately as each item is processed). If there is a failure during the processing iteration, we can retry the job, and it should start from where we left off, but that only works if we are outside of the "acidic" transaction (because otherwise all the persisted processed items are rolled back in the event of an error). Hope this makes sense.

Maybe there is another way of thinking about it within the AcidicJob frame of mind that I'm not seeing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant