runlight 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -365,6 +365,11 @@ module Runlight
365
365
  result = yield(self)
366
366
  limit_statements(@statement_timeout) if @statement_timeout.positive?
367
367
  result
368
+ rescue Exception
369
+ # The connection goes back to the pool, so a block that fails must not leave it without its
370
+ # statement timeout: it is put back, or the session starts over, which sets it again.
371
+ limit_again(c) if @statement_timeout.positive?
372
+ raise
368
373
  ensure
369
374
  begin
370
375
  c.execute("DO RELEASE_LOCK(#{MYSQL_LOCK})")
@@ -374,6 +379,16 @@ module Runlight
374
379
  end
375
380
  end
376
381
 
382
+ def limit_again(c)
383
+ limit_statements(@statement_timeout)
384
+ rescue StandardError
385
+ begin
386
+ c.reconnect!
387
+ rescue StandardError
388
+ # Gone for good: the pool replaces a connection it cannot verify.
389
+ end
390
+ end
391
+
377
392
  def monotonic_ms
378
393
  Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond)
379
394
  end
@@ -4,7 +4,7 @@ require "json"
4
4
 
5
5
  module Runlight
6
6
  # The gem's own version, which the release keeps equal to the npm package's.
7
- GEM_VERSION = "0.3.2"
7
+ GEM_VERSION = "0.3.3"
8
8
 
9
9
  # The SDK's version and the HTTP API's, read from assets/build.json, which
10
10
  # scripts/ruby-assets.mts writes from the TypeScript SDK, so the two always
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runlight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon C. Phillips
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-27 00:00:00.000000000 Z
11
+ date: 2026-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord