Skip to content

Commit b4280b8

Browse files
committed
Propagate set_headers failure in client bridge
1 parent aeaf17a commit b4280b8

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

temporalio/ext/src/client.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,9 @@ impl Client {
237237
self.invoke_rpc(service, callback, call)
238238
}
239239

240-
pub fn update_metadata(&self, headers: HashMap<String, String>) {
241-
self.core.get_client().set_headers(headers);
240+
pub fn update_metadata(&self, headers: HashMap<String, String>) -> Result<(), Error> {
241+
self.core.get_client().set_headers(headers)
242+
.map_err(|err| error!("Invalid headers: {}", err))
242243
}
243244

244245
pub fn update_api_key(&self, api_key: Option<String>) {

temporalio/lib/temporalio/cancellation.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ def prepare_cancel(reason:)
167167
to_return.values
168168
end
169169

170-
def canceled_mutex_synchronize(&)
171-
Workflow::Unsafe.illegal_call_tracing_disabled { @canceled_mutex.synchronize(&) }
170+
def canceled_mutex_synchronize(&block)
171+
Workflow::Unsafe.illegal_call_tracing_disabled { @canceled_mutex.synchronize(&block) }
172172
end
173173
end
174174
end

temporalio/lib/temporalio/internal/worker/workflow_instance/outbound_implementation.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def execute_local_activity(input)
121121
end
122122
end
123123

124-
def execute_activity_with_local_backoffs(local:, cancellation:, result_hint:, &)
124+
def execute_activity_with_local_backoffs(local:, cancellation:, result_hint:, &block)
125125
# We do not even want to schedule if the cancellation is already cancelled. We choose to use canceled
126126
# failure instead of wrapping in activity failure which is similar to what other SDKs do, with the accepted
127127
# tradeoff that it makes rescue more difficult (hence the presence of Error.canceled? helper).
@@ -130,7 +130,7 @@ def execute_activity_with_local_backoffs(local:, cancellation:, result_hint:, &)
130130
# This has to be done in a loop for local activity backoff
131131
last_local_backoff = nil
132132
loop do
133-
result = execute_activity_once(local:, cancellation:, last_local_backoff:, result_hint:, &)
133+
result = execute_activity_once(local:, cancellation:, last_local_backoff:, result_hint:, &block)
134134
return result unless result.is_a?(Bridge::Api::ActivityResult::DoBackoff)
135135

136136
# @type var result: untyped
@@ -142,9 +142,9 @@ def execute_activity_with_local_backoffs(local:, cancellation:, result_hint:, &)
142142
end
143143

144144
# If this doesn't raise, it returns success | DoBackoff
145-
def execute_activity_once(local:, cancellation:, last_local_backoff:, result_hint:, &)
145+
def execute_activity_once(local:, cancellation:, last_local_backoff:, result_hint:, &block)
146146
# Add to pending activities (removed by the resolver)
147-
seq = yield last_local_backoff
147+
seq = block.call(last_local_backoff)
148148
@instance.pending_activities[seq] = Fiber.current
149149

150150
# Add cancellation hook

0 commit comments

Comments
 (0)