▲ | latchkey a day ago | |
Why not always default to using transactions? | ||
▲ | qianli_cs a day ago | parent [-] | |
DBOS always uses transactions to perform database operations. If you're writing a function that performs database operations, you can use the @DBOS.transaction() decorator to wrap the function so that DBOS's bookkeeping records commit in the same transaction as your operation. However, if you're interfacing with a third-party API, then that wouldn't be part of a database transaction (you'll use @DBOS.step instead). The reason is that you don't want to hold database locks when you're not performing database operations. |