tursodatabase / turso-cli

Command line interface to Turso.
https://turso.tech
MIT License
224 stars 37 forks source link

Turso shell does not inform users about transactions timing out #671

Open psarna opened 1 year ago

psarna commented 1 year ago

If you type BEGIN IMMEDIATE; into turso shell, it times out on the server after 5 seconds, but this fact is not reported to the user in any way. So if one does the following:

  1. BEGIN IMMEDIATE
  2. (wait 6 seconds)
  3. INSERT INTO t VALUES (42)
  4. INSERT INTO t VALUES (43)
  5. COMMIT

... they'll get an error on COMMIT saying that "no transaction is active", but what's worse, (3.) and (4.) look like they're part of a single atomic operation, and they are not. The transaction started in (1.) timed out without any notification, so inserts from (3.) and (4.) are sent outside of this transaction's scope. We should instead be clear that BEGIN IMMEDIATE returns an error when a transaction times out. We should track that we're inside a transaction, and if a subsequent query gets an error saying that a session expired, we need to error out.

haaawk commented 1 year ago

That's probably an issue of https://github.com/libsql/libsql-shell-go