Start using transaction decorator instead of `run_in_transaction`
See original GitHub issueReplace all usages of run_in_transaction
with the new run_in_transaction_wrapper
.
List of files
- email_manager.py @Nik-09
- feedback_jobs_continuous.py @Nik-09
- feedback_services.py @lkbhitesh07
- question_services.py @lkbhitesh07
- rating_services.py @vojtechjelinek (#11741)
- stats_services.py @lkbhitesh07
- suggestion_jobs_one_off.py @lkbhitesh07
- suggestion_services.py @lkbhitesh07
- user_services.py @lkbhitesh07
- wipeout_services.py @OBITORASU
- jobs.py @lkbhitesh07
- base_model/gae_models.py @OBITORASU
- statistics/gae_models.py @lkbhitesh07
- user_jobs_continuous.py @lkbhitesh07
Steps to refactor
- Claim one of the files listed above by pinging @vojtechjelinek.
- Look at the occurrences of
run_in_transaction
in the claimed file. - 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, thetransaction_services.run_in_transaction(_update_user_rating)
should be replaced with_update_user_rating_transactional()
. - See #11741 for reference
After all occurences are replaced remame the run_in_transaction_wrapper
to run_in_transaction
.
Issue Analytics
- State:
- Created 3 years ago
- Comments:26 (24 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@OBITORASU The
BaseModel.delete_multi
can be used in other files, also since some models inherit fromBaseModel
(likeUserSettingsModel
), thedelete_multi
can be used in these classes too.Also another question regarding the
wipeout_services.py
Just to confirm, is itwipeout_services.py
orwipeout_service.py
? Apparently I can’t fuzzy findwipeout_services.py
the closest file to it iswipeout_service.py
which I can find.