railwatch 0.3.6 → 0.3.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7670085bcbae37c58def37c8e23ffee964be9277a57462869346017016c33a3c
4
- data.tar.gz: fb68d72c0863778eb607cfd2bded53714651caaecffefbff20994e25422a1411
3
+ metadata.gz: 56eb44eab9d0988d36c517995ad2ec8d42971ed9af60e3cf4c419c5df926007f
4
+ data.tar.gz: 20f9bfed5d8044797a1e43b523668846b2b888756ff9fef59a1f54dc136d64c1
5
5
  SHA512:
6
- metadata.gz: 429bb5789a56059dce9848403622511df0f5094c2efe4a6ed8c51e5086fb11eaf56b8c762ee9ae68d1ae393a5fae7af65d628df019f01b00466644e207aa6b1d
7
- data.tar.gz: 0c38280c362f3529ca2af1e93a6982d77ed15a872351072727dd1152396ea2c3f1a2e634f1132a6cac83bf0ee152f818fda15db76e2251a3f0f1a7a24db5bfb1
6
+ metadata.gz: 8bbd22e4636c6c3ba58dfff0242d3553db415af9b90041b524634ae7b95e65a0ff52f6584c7d6c4c61aee12274e177b308d06040508db41ee8db0af81ff1ab0d
7
+ data.tar.gz: 398eea6fd06b824600b834f5da026f68b70fba6a5bcc1ec97c73995933ca9a8e569cca0d5135f27ee413563281bd91a941eb19ccb954f0b731cd25b2446ba86c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.7 (2026-09-20)
4
+
5
+ - Stop a rake task or `rails runner` waiting on the network as it finishes.
6
+ The command patches called `Railwatch.flush` when the execution closed --
7
+ on the application's own thread, with no time limit. The engine's `at_exit`
8
+ already calls `Reporter#shutdown`, which wakes the reporter thread and joins
9
+ it for `shutdown_timeout`, so the same records were already being delivered,
10
+ already bounded, and a failed task's exception already went with them. The
11
+ flush was a second, unbounded way to do it.
12
+
13
+ Against a receiver that accepts connections and never answers, that second
14
+ way cost a full timeout ladder per process -- measured at ~6s, and ~12s when
15
+ it queued behind a delivery the reporter thread was already stuck in. An app
16
+ whose container entrypoint boots Rails eleven times before starting Puma
17
+ spent that on every boot and lost the deploy to its proxy's timeout. With
18
+ the call removed the task returns immediately and the process still leaves
19
+ within `shutdown_timeout`, carrying the same records.
20
+
21
+ Only short-lived processes were affected: web and worker processes flush on
22
+ the reporter's own thread and never blocked. `Railwatch.flush` is unchanged
23
+ and still public, for a caller who wants to wait on purpose.
24
+
25
+ - Add a process-level regression that runs a failing rake task against a
26
+ socket that accepts and never answers, and asserts the task returns without
27
+ waiting on it and the process exits inside the shutdown bound. In-process
28
+ examples cannot see this: the cost lives in a socket read and the bound in
29
+ an `at_exit` join.
30
+
3
31
  ## 0.3.6 (2026-09-20)
4
32
 
5
33
  - Harden embedded live-stream authorization and telemetry delivery. Bound
@@ -431,9 +431,14 @@ affects one probabilistic decision. Set `backpressure` false to keep the
431
431
  factor at 1. The current value is sent as
432
432
  `X-Railwatch-Backpressure-Factor` whenever it is greater than 1.
433
433
 
434
- `Railwatch.flush` forces an immediate flush. The `command` patches also
435
- call it after a rake task/runner invocation finishes, so short-lived
436
- processes don't lose their last batch to the flush interval. An unhandled
434
+ `Railwatch.flush` forces an immediate flush, on the calling thread and
435
+ without a time limit, so it is yours to call when you know you want to
436
+ wait. Nothing in the gem calls it for you: a short-lived process keeps its
437
+ last batch because the engine's `at_exit` runs `Reporter#shutdown`, which
438
+ wakes the reporter thread and joins it for `shutdown_timeout`. That is a
439
+ bounded wait, which is what a rake task, a runner or a cron job needs --
440
+ a receiver that accepts connections and never answers then costs
441
+ `shutdown_timeout`, not a timeout ladder per process. An unhandled
437
442
  exception goes through `Railwatch.record_now` → `Reporter#write_now`,
438
443
  which enqueues the record and asks for an urgent flush. It never performs
439
444
  network I/O or a timeout cycle on the application thread. Urgent means
@@ -72,7 +72,16 @@ module Railwatch
72
72
  name: name,
73
73
  command: "rake #{name}#{command_suffix}",
74
74
  exit_code: exit_code.to_i.clamp(0, 255))
75
- Railwatch.flush
75
+ # Deliberately no flush. The engine's at_exit calls Reporter#shutdown,
76
+ # which wakes the reporter thread and joins it for shutdown_timeout --
77
+ # already a bounded last delivery, and already the one that ships a
78
+ # failed task's exception. Flushing here as well delivered the same
79
+ # records a second way, on the application's own thread, with no
80
+ # bound: against a receiver that accepts connections and never
81
+ # answers it cost a full timeout ladder per process, measured at ~6s,
82
+ # and ~12s when it queued behind a delivery the reporter thread was
83
+ # already stuck in. An app whose entrypoint boots Rails eleven times
84
+ # spent that eleven times over and lost the deploy.
76
85
  end
77
86
  end
78
87
 
@@ -91,7 +91,9 @@ module Railwatch
91
91
  }
92
92
  fields[:interactive] = true if interactive
93
93
  Railwatch.finish_execution(:command, **fields)
94
- Railwatch.flush
94
+ # No flush here either; see the note in patches/rake_task.rb. The
95
+ # at_exit shutdown is the bounded delivery, and it runs for a runner
96
+ # exactly as it does for a task.
95
97
  end
96
98
  end
97
99
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Railwatch
4
- VERSION = "0.3.6"
4
+ VERSION = "0.3.7"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railwatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cole Robertson