Pregunta

I am currently trying to modify a plugin for posting metrics to new-relic via AWS. I have successfully managed to make the plugin post metrics from swf to new relic (not originally in plugin), but have encountered a problem if the program runs for too long.

When the program runs for a bout 10 minutes I get the following error:

Error occurred in poll cycle: Rate exceeded

I believe this is coming from my polling swf for the workflow executions

domain.workflow_executions.each do |execution|

        starttime = execution.started_at
        endtime = execution.closed_at
        isOpen = execution.open?
        status = execution.status

        if endtime != nil
          running_workflow_runtime_total += (endtime - starttime)
          number_of_completed_executions += 1
        end

        if status.to_s == "open"
          openCount = openCount + 1
        elsif status.to_s == "completed"
          completedCount = completedCount + 1
        elsif status.to_s == "failed"
          failedCount = failedCount + 1
        elsif status.to_s == "timed_out"
          timed_outCount = timed_outCount + 1
        end

      end

This is called in a polling cycle every 60 seconds

Is there a way to set the polling rate? Or another way to get the workflow executions?

Thanks, here's a link to the ruby sdk for swf => link

¿Fue útil?

Solución

The issue is likely that you are creating a large number of workflow executions and each iteration through the loop in workflow_executions is causing a lookup, which eventually is exceeding your rate limit.

This could also be getting a bit expensive, so be careful.

It's not clear what you're really trying to do, so I can't tell you how to fix it unless you post all your code (or the parts around calls to SWF).

You can see here:

https://github.com/aws/aws-sdk-ruby/blob/05d15cd1b6037e98f2db45f8c2597014ee376a59/lib/aws/simple_workflow/workflow_execution_collection.rb

That a call is made to SWF for each workflow in the collection.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top