Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c52d376
Add all Ruby SDK reference files (11 files, ~2100 lines)
donald-pinckney Mar 16, 2026
0dcac1e
Fix alignment issues in Ruby reference files
donald-pinckney Mar 16, 2026
dfcdc82
Fix correctness issues in Ruby reference files
donald-pinckney Mar 16, 2026
ef5d989
Add Ruby to all language references in SKILL.md and core files
donald-pinckney Mar 16, 2026
2e936b2
Merge branch 'main' into add-ruby-support
donald-pinckney May 26, 2026
f9c81ee
Apply suggestions from code review
donald-pinckney May 26, 2026
c3181b8
Apply suggestions from code review
donald-pinckney May 26, 2026
5312401
Apply suggestion from @chris-olszewski
donald-pinckney May 26, 2026
734a347
copy over sample code
donald-pinckney May 26, 2026
ce0d434
Remove useless section, mention Mutex
donald-pinckney May 27, 2026
d051bf3
cleanup mutex mentions
donald-pinckney May 27, 2026
b22eb20
Clean up transitive NDE section
donald-pinckney May 28, 2026
b0630d7
Menial changes to align to python structure
donald-pinckney May 28, 2026
afc00ef
Add Workflow Init section to Ruby advanced-features
donald-pinckney May 28, 2026
d3b0c3c
Document graceful_shutdown_period in Ruby Worker Tuning
donald-pinckney May 28, 2026
76a4f02
Propagate cancellation in Ruby activity-error handling
donald-pinckney May 28, 2026
41c6f0e
Align Ruby Workflow Failure section to Python
donald-pinckney May 28, 2026
adcb0d4
Add logger configuration to Ruby observability
donald-pinckney May 28, 2026
1269e03
Make Ruby Saga compensations cancellation-proof
donald-pinckney May 28, 2026
b08606a
Document patched() memoization caveat in Ruby versioning
donald-pinckney May 28, 2026
d0d5f4b
Add default versioning behavior to Ruby worker versioning
donald-pinckney May 28, 2026
649d296
Fix worker versioning config API names in Ruby docs
donald-pinckney May 28, 2026
dc1994b
Fix worker concurrency config in Ruby Worker Tuning
donald-pinckney May 28, 2026
5fe7a95
Align Ruby Workflow Init title with Python
donald-pinckney May 28, 2026
2c4004a
Structure Ruby Metrics to match Python
donald-pinckney May 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make Ruby Saga compensations cancellation-proof
Run saga compensations with a detached Temporalio::Cancellation so they
still execute when the workflow is canceled mid-saga. Previously they
used the workflow cancellation, which is already canceled at that point,
so the compensation activities would be canceled before starting. This
is the Ruby equivalent of Python's asyncio.shield.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
  • Loading branch information
donald-pinckney and claude committed May 28, 2026
commit 1269e03aeba53d94fc61a61479c00c7a84c83deb
15 changes: 10 additions & 5 deletions references/ruby/patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,21 +214,23 @@ class MyWorkflow < Temporalio::Workflow::Definition
# 3. but then fails for some other reason (timeout, reporting metrics, etc.)
# 4. the activity failed, but the effect (reserved inventory) already happened
# So the compensation must handle both reserved and unreserved states.
compensations << lambda {
compensations << lambda { |cancellation|
Temporalio::Workflow.execute_activity(
ReleaseInventoryIfReserved, order,
start_to_close_timeout: 300
start_to_close_timeout: 300,
cancellation: cancellation
)
}
Temporalio::Workflow.execute_activity(
ReserveInventory, order,
start_to_close_timeout: 300
)

compensations << lambda {
compensations << lambda { |cancellation|
Temporalio::Workflow.execute_activity(
RefundPaymentIfCharged, order,
start_to_close_timeout: 300
start_to_close_timeout: 300,
cancellation: cancellation
)
}
Temporalio::Workflow.execute_activity(
Expand All @@ -245,9 +247,12 @@ class MyWorkflow < Temporalio::Workflow::Definition

rescue => e
Temporalio::Workflow.logger.error("Order failed: #{e}, running compensations")
# Use a detached cancellation so compensations still run even if the workflow
# was canceled (the workflow's own cancellation is already canceled by then).
detached_cancel, = Temporalio::Cancellation.new
compensations.reverse.each do |compensate|
begin
compensate.call
compensate.call(detached_cancel)
rescue => comp_err
Temporalio::Workflow.logger.error("Compensation failed: #{comp_err}")
end
Expand Down