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.

Start using transaction decorator instead of `run_in_transaction`

See original GitHub issue

Replace all usages of run_in_transaction with the new run_in_transaction_wrapper.

List of files

Steps to refactor

  1. Claim one of the files listed above by pinging @vojtechjelinek.
  2. Look at the occurrences of run_in_transaction in the claimed file.
  3. Instead of doing for example transaction_services.run_in_transaction(_update_user_rating) on top of the definition of _update_user_rating the @transaction_services.run_in_transaction_wrapper decorator should be added. In the callsite, the transaction_services.run_in_transaction(_update_user_rating) should be replaced with _update_user_rating_transactional().
  4. See #11741 for reference

After all occurences are replaced remame the run_in_transaction_wrapper to run_in_transaction.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:26 (24 by maintainers)

github_iconTop GitHub Comments

1reaction
vojtechjelinekcommented, Jan 29, 2021

@OBITORASU The BaseModel.delete_multi can be used in other files, also since some models inherit from BaseModel (like UserSettingsModel), the delete_multi can be used in these classes too.

1reaction
OBITORASUcommented, Jan 29, 2021

Also another question regarding the wipeout_services.py Just to confirm, is it wipeout_services.py or wipeout_service.py ? Apparently I can’t fuzzy find wipeout_services.py the closest file to it is wipeout_service.py which I can find.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Transactions - typeorm - GitBook
Using QueryRunner to create and control state of single database connection ; startTransaction - starts a new transaction inside the query runner instance....
Read more >
Returning value from runInTransaction() In Android Room ...
While executing multiple operations on different DAO's if no value is to be returned I could use runInTransaction(Runnable body) OR ...
Read more >
Transactions does not work with multi tenant application #93
I am using nest.js to create a multi tenant application, so the module creates the ... runInTransaction function instead of the decorator ......
Read more >
Transaction - Android Developers
Transaction instead. public abstract @interface Transaction implements Annotation. android.arch.persistence.room.Transaction ...
Read more >
About transactions | Cloud Spanner
... you should use a read-only transaction instead of a read-write transaction. ... Transaction Txn2 in green starts after Txn1 , reads some...
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