chrono_machines 0.10.0 → 0.11.0

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: 520c4b33c24d8122f82758ed724886bfdd7955b427a98de6432bfd2b85f8355e
4
- data.tar.gz: 7f31ccc205a392a0f26f932cdebdd13efb56204137598d38e818768f6116da53
3
+ metadata.gz: e4195a7a57a7069769ba6b45dec7b2187ffd78be09e03d79c6b744881306423d
4
+ data.tar.gz: 17d103b281d335cd9b0d2d78590a57f9eb5f5e68eaf3910aa07b51ccfe1a7cb3
5
5
  SHA512:
6
- metadata.gz: 51dbb600f208195e5c42f6cc8eec21069aa361f1c1056df5c960ea331a4335c1f18fb328fb27748d5535d9477fea99ae20f1a5961b1cd53ced563b336bc96542
7
- data.tar.gz: 7a82f044a7fe6e185399021cb09e141a51e0370a468767df79058cf78567fda1ecc96dc0b916de6154d02b828a4b5b4ac803a5a0aa7e78078c147220383c0bfc
6
+ metadata.gz: 9d8638c3dbdfa33e746beecba8e3e5cfc92a75cce7c315a604d07a5e108188dcff339a03406c66e220a2dcaa8ec28115d9b3047179fdbe214e9ba95b1115f0ce
7
+ data.tar.gz: 167d0237c2ff6ea4e0958befc179f60b5a518b44ac86106a3409f5a0ae611809b1a43520a928d3a5026cd1389429aeab856f7d15522df3703259767d23100020
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.11.0](https://github.com/seuros/chrono_machines/compare/chrono_machines/v0.10.0...chrono_machines/v0.11.0) (2026-10-14)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * **core:** RetryError::cause() returns &E and into_cause() returns E instead of Option.
9
+
10
+ ### Features
11
+
12
+ * **core:** RetryError always carries its cause ([e5222a3](https://github.com/seuros/chrono_machines/commit/e5222a3c394974ba86605944f02d820345cbae8e))
13
+
3
14
  ## [0.10.0](https://github.com/seuros/chrono_machines/compare/chrono_machines/v0.9.2...chrono_machines/v0.10.0) (2026-10-11)
4
15
 
5
16
 
data/README.md CHANGED
@@ -223,6 +223,8 @@ Anything else raises `ArgumentError` - a broken hook fails loudly instead of sil
223
223
 
224
224
  ### Scheduling retries without sleeping
225
225
 
226
+ See the [Rails integration guide](docs/RAILS_INTEGRATION.md) for Active Job patterns, policy callbacks, and safe retries.
227
+
226
228
  `Executor#next_delay(attempt:, exception: nil)` returns seconds to wait, or `nil` to stop. `attempt: 1` means the initial call has failed; `max_attempts` includes that initial call. It uses the same backoff, jitter, exception rules, and `delay_from` hints as `call`, without executing work, sleeping, or running lifecycle callbacks. The caller owns the attempt count and scheduling. Without an exception, `delay_from` and exception filtering are skipped.
227
229
 
228
230
  For Active Job's `retry_on`, keep the attempt limit in sync with the policy:
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "chrono-machines"
3
- version = "0.8.1"
3
+ version = "0.9.0"
4
4
  edition.workspace = true
5
5
  rust-version.workspace = true
6
6
  authors = ["Abdelkader Boudih <terminale@gmail.com>"]
@@ -51,13 +51,7 @@ fn finalize_failure<E>(
51
51
  cumulative_delay_ms: u64,
52
52
  error: E,
53
53
  ) -> RetryError<E> {
54
- let retry_error = RetryError::new(
55
- kind,
56
- attempt,
57
- max_attempts,
58
- cumulative_delay_ms,
59
- Some(error),
60
- );
54
+ let retry_error = RetryError::new(kind, attempt, max_attempts, cumulative_delay_ms, error);
61
55
  if let Some(callback) = on_failure {
62
56
  callback(&retry_error);
63
57
  }
@@ -99,7 +93,7 @@ pub struct RetryError<E> {
99
93
  attempts: u8,
100
94
  max_attempts: u8,
101
95
  cumulative_delay_ms: u64,
102
- cause: Option<E>,
96
+ cause: E,
103
97
  }
104
98
 
105
99
  impl<E> RetryError<E> {
@@ -108,7 +102,7 @@ impl<E> RetryError<E> {
108
102
  attempts: u8,
109
103
  max_attempts: u8,
110
104
  cumulative_delay_ms: u64,
111
- cause: Option<E>,
105
+ cause: E,
112
106
  ) -> Self {
113
107
  Self {
114
108
  kind,
@@ -119,13 +113,13 @@ impl<E> RetryError<E> {
119
113
  }
120
114
  }
121
115
 
122
- /// Retrieve the underlying cause when available.
123
- pub const fn cause(&self) -> Option<&E> {
124
- self.cause.as_ref()
116
+ /// The error from the final attempt.
117
+ pub const fn cause(&self) -> &E {
118
+ &self.cause
125
119
  }
126
120
 
127
- /// Consume the error and return the underlying cause when available.
128
- pub fn into_cause(self) -> Option<E> {
121
+ /// Consume the error and return the error from the final attempt.
122
+ pub fn into_cause(self) -> E {
129
123
  self.cause
130
124
  }
131
125
 
@@ -175,13 +169,11 @@ where
175
169
  }
176
170
  }
177
171
 
178
- write!(f, " (cumulative delay {}ms)", self.cumulative_delay_ms)?;
179
-
180
- if let Some(cause) = self.cause.as_ref() {
181
- write!(f, ": {cause}")?;
182
- }
183
-
184
- Ok(())
172
+ write!(
173
+ f,
174
+ " (cumulative delay {}ms): {}",
175
+ self.cumulative_delay_ms, self.cause
176
+ )
185
177
  }
186
178
  }
187
179
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ChronoMachines
4
- VERSION = '0.10.0'
4
+ VERSION = '0.11.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chrono_machines
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih