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

Add retry mechanism that handles the watchdog_about_to_expire error #46

Merged
merged 1 commit into from
Oct 23, 2023

Conversation

ConnorRigby
Copy link
Contributor

This adds a retry mechanism that will try for up to one second by default to retry any transaction that return {:error, :watchdog_about_to_expire}

@ConnorRigby ConnorRigby force-pushed the cjr-watchdog-expire-retry branch 2 times, most recently from ebe4f36 to 0eb464f Compare October 20, 2023 16:01
lib/atecc508a/request.ex Outdated Show resolved Hide resolved
lib/atecc508a/request.ex Outdated Show resolved Hide resolved
) :: {:ok, binary()} | {:error, atom()}
defp transport_request(transport, payload, timeout, response_payload_len, retry \\ 1000) do
now = System.monotonic_time(:second)
retry_request_with_timeout(transport, payload, timeout, response_payload_len, now, retry)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
retry_request_with_timeout(transport, payload, timeout, response_payload_len, now, retry)
retry_request_with_timeout(transport, payload, give_up_time, response_payload_len)

lib/atecc508a/request.ex Outdated Show resolved Hide resolved
lib/atecc508a/request.ex Outdated Show resolved Hide resolved
lib/atecc508a/request.ex Outdated Show resolved Hide resolved
{:ok, @test_data_32}
end)

assert Request.read_zone(@mock_transport, :config, 0, 32) == {:ok, @test_data_32}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks for adding a test!

lib/atecc508a/request.ex Outdated Show resolved Hide resolved
lib/atecc508a/request.ex Outdated Show resolved Hide resolved
@ConnorRigby ConnorRigby force-pushed the cjr-watchdog-expire-retry branch 3 times, most recently from e835ac0 to 4af604b Compare October 23, 2023 15:45
Signed-off-by: Connor Rigby <connorr@hey.com>
@fhunleth fhunleth merged commit 99c6095 into main Oct 23, 2023
5 checks passed
@fhunleth fhunleth deleted the cjr-watchdog-expire-retry branch October 23, 2023 20:37
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

Successfully merging this pull request may close these issues.

None yet

2 participants