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.

Can't set "repetitionAttempts" for suspended transactions

See original GitHub issue

I think the title already explains everything, there isn’t a way to set the repetition attempts for newSuspendedTransaction or suspendedTransactionAsync

Also, I may be wrong, but it seems that by default suspended transactions do not retry like how transaction behaves, it always fails when a concurrent update/delete/etc exception happens, while with non suspended transactions Exposed tries again.

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
MrPowerGamerBRcommented, Oct 11, 2020

My own workaround for this issue, mimicking Exposed’s transaction behavior.:

    suspend fun <T> newSuspendedTransaction(repetitions: Int = 5, statement: org.jetbrains.exposed.sql.Transaction.() -> T): T {
        var lastException: Exception? = null
        for (i in 1..repetitions) {
            try {
                return org.jetbrains.exposed.sql.transactions.experimental.newSuspendedTransaction(Dispatchers.IO, Databases.loritta) {
                    statement.invoke(this)
                }
            } catch (e: ExposedSQLException) {
                logger.warn(e) { "Exception while trying to execute query. Tries: $i" }
                lastException = e
            }
        }
        throw lastException ?: RuntimeException("This should never happen")
    }
1reaction
MrPowerGamerBRcommented, Dec 9, 2022

@MrPowerGamerBR are you still using this workaround? I encountered a similar issue and i guess will go a the same route then you since i did not find any other option to provide a retry value. Btw. thanks for providing the sample code 👍

Yup! And it works fine 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve blocking problem caused by lock escalation - SQL ...
This article describes how to determine whether lock escalation is causing blocking and how to resolve the problem.
Read more >
Do suspended transactions timeout? - Stack Overflow
1 Answer 1 ... AFAIK you cant configure what will happen to timeout of outer transaction. Nested transaction will never set timeout on...
Read more >
eBay Account Suspended? Why It Happens and What You ...
When there is a breach of eBay's policy, sellers can have their accounts suspended. An eBay suspension means business interruption, ...
Read more >
eBay Suspended Your Account? Here's What to Do - Sellbrite
It's not uncommon for sellers using stealth accounts to run into the same issues or repeat the same problem that got them suspended...
Read more >
Do Customer Accounts Get Suspended?
amazon closed my inicial account, withou any reason, we try to contact them ... You can't just “create other accounts”, or use VPNs...
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