Skip to content

Instantly share code, notes, and snippets.

@BiggerNoise
Created September 4, 2013 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BiggerNoise/6442159 to your computer and use it in GitHub Desktop.
Save BiggerNoise/6442159 to your computer and use it in GitHub Desktop.
Proposed way to rework the execute() method in ActivityTaskPoller so that it does not mark an activity as failed when only the completion notification fails
def execute(task)
activity_type = task.activity_type
begin
context = ActivityExecutionContext.new(@service, @domain, task)
activity_implementation = @activity_definition_map[activity_type]
raise "This activity worker was told to work on activity type #{activity_type.name}, but this activity worker only knows how to work on #{@activity_definition_map.keys.map(&:name).join ' '}" unless activity_implementation
output = activity_implementation.execute(task.input, context)
@logger.debug "Responding on task_token #{task.task_token} for task #{task}"
rescue ActivityFailureException => e
respond_activity_task_failed_with_retry(task.task_token, e.message, e.details)
end
unless activity_implementation.execution_options.manual_completion
notification_complete = false
until notification_complete
begin
@service.respond_activity_task_completed(:task_token => task.task_token, :result => output)
notification_complete = true
rescue Exception => e
@logger.info "Got error #{e} while notifying service of task completion"
end
end
end
#TODO all the completion stuffs
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment