Closed mattg23 closed 1 year ago
Generally I agree with the solution. But I think it can be made a bit simpler, and also I think we should insert compile-time assertions to ensure that this bug doesn't appear later and in other places. I had no chance to take a look at this yet, though.
My plan is to work on this project between christmas and new year again. If you have any ideas / pointers, I can try improving it.
Well, I can't come up with something significantly better (except maybe let..else
but that's too early probably). Just fix formatting (spaces around else
and indentation of the second line of log
).
Assertion can be done by adding a function that enforce types, but otherwise unused in the code:
#[allow(dead_code)]
fn _assertions() {
let cli: Client = unimplemented!();
assert_send_sync(cli.transaction(|tx| _));
}
fn assert_send_sync<T: Send+Sync>(_: T) {}
Sounds good, I'll prep a PR after christmas.
Fixed in #199
Describe the bug Using transactions is not
Send
.Reproduction I am using the client in an async axum handler with the following code:
The rust compiler complains about:
I've moved the check for the
SHOULD_RETRY
tag, such that the&dyn StdError
can be dropped before theawait
. This change https://github.com/mattg23/edgedb-rust/commit/20d0e467e3359995bca6ad399d8dfa534c38b851 works for me. The behavior of the code should be identical to how it was before.I'm quite new to rust and edgedb so I wanted to open the issue and not just send a PR. Any feedback is welcome.
Versions (please complete the following information):