Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use retry in on_timer function #31

Open
vinoth3105 opened this issue Dec 28, 2020 · 1 comment
Open

how to use retry in on_timer function #31

vinoth3105 opened this issue Dec 28, 2020 · 1 comment

Comments

@vinoth3105
Copy link

How to use retry function if API call is failed.

Below I have mention code:

def on_timer
body = nil
record = nil

begin
res = RestClient::Request.execute request_options
record, body = get_record(res)

rescue StandardError => err
record = { "url" => @url, "error" => err.message }
if err.respond_to? :http_code
record["status"] = err.http_code || 0
else
record["status"] = 0
end
end

record_time = Engine.now
record = parse(record, body)
router.emit(@tag, record_time, record)
end

Can you please help on that..

@vinoth3105
Copy link
Author

How to use retry function if API call is failed.

Below I have mention code:

def on_timer
body = nil
record = nil

begin
res = RestClient::Request.execute request_options
record, body = get_record(res)

rescue StandardError => err
record = { "url" => @url, "error" => err.message }
if err.respond_to? :http_code
record["status"] = err.http_code || 0
else
record["status"] = 0
end
end

record_time = Engine.now
record = parse(record, body)
router.emit(@tag, record_time, record)
end

Can you please help on that..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant