-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Leaked write transactions are hard to avoid #320
Comments
Aborting on drop would swallow errors, since |
Ah yes, I like that better. I avoided automatically aborting since it would ignore the errors, but if |
Sweet, this is great! I can remove my weird AbortOnDrop wrapper now. |
Just released this in 0.5.0 |
Sweet, we'll update soon. The ordinal explorer is getting more featureful by the way: The front page returns a list containing every signet block, which requires iterating over a 100k entry table, and redb is super fast. The only reason we're doing something so stupid is because we haven't implemented pagination, but it's nice that we don't need to implement pagination just because our database is slow. (The reason we have to implement pagination is because it's not polite to return 16 MiB of HTML unless you're the whatwg.) |
You can also look up ordinals now by name, number, degree, or decimal: https://signet.ordinals.com/ordinal/cberner |
Nice! How is the name calculated? |
It's close to being a straight conversion from base 10 / |
Idiomatic code tends to leak write transactions. We have a few places in
ord
where we're doing something like this:If
might_fail
returnsResult::Err
, then we'll leak the write transaction, and get the message about leaking write transactions.To work around this and avoid getting the error message, we have to introduce wrappers like this:
Also, sometimes there isn't just one function
might_fail
, there are a few in sequence, and either each one needs a wrapper, or the sequence needs to be extracted into a sub-function, so that you canmatch sub_function(tx)
. Both options are pretty verbose.Given that, perhaps write transactions should just abort on drop?
The text was updated successfully, but these errors were encountered: