question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting to turn off atomic transactions

See original GitHub issue

The methods run_task() and run_next_task() are both annotated @atomic. I wonder what the reason for this is.

Django has a setting ATOMIC_REQUESTS for tying transactions to HTTP requests. Could we have a similar setting to control whether background tasks are executed within an atomic transaction or not?

This could be useful for cases where people are forced to use SQLite, but want to minimize the time the database gets locked. Currently, the atomic transaction locks the database for the entire task duration even if only read-only transactions are executed. This can be problematic for long-running tasks that do network requests for example.

It would also give a task author the opportunity to control which parts of their tasks should be run within a transaction. Currently, you are forced into one large transaction.

PS. Yes, I am aware that SQLite does not support concurrency and that this is a known issue.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
blank-blank-blankcommented, Nov 18, 2017

How about we just drop the atomic decorator completely until an option is created? This is more confusing than helpful, especially since the documentation doesn’t mention either behavior at all.

0reactions
walterrennercommented, Jan 26, 2018

@philippeowagner i don’t see any side effects when removing the decorator.

I just removed the @atomic decorators and ran the tox test suite. Every test has passed. So removing it completely is fine for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disable atomic transaction in Django 1.11 change view
Many pieces of Django use transactions because they're essential to ensuring correct behavior. So there's no setting or other method to disable ......
Read more >
The trouble with transaction.atomic - David Seddon
We generally want to keep the majority of our tests wrapped in transactions. We can work around this by making the check possible...
Read more >
Configure Web service atomic transactions - Oracle Help Center
At development time, you can enable Web services atomic transactions using the @weblogic.wsee.wstx.wsat.Transactional annotation in the JWS file or client ...
Read more >
Database transactions | Django documentation
You can totally disable Django's transaction management for a given database by setting AUTOCOMMIT to False in its configuration. If you do this,...
Read more >
Atomic Transaction - an overview | ScienceDirect Topics
However, to achieve this, the refresh operation has to disable use of some operations, such as parallel execution and bulk inserts, which are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found