Skip to content

Refactor retry logic#578

Open
awiddersheim wants to merge 3 commits intoossec:masterfrom
awiddersheim:fix/rewrite_retry_logic
Open

Refactor retry logic#578
awiddersheim wants to merge 3 commits intoossec:masterfrom
awiddersheim:fix/rewrite_retry_logic

Conversation

@awiddersheim
Copy link
Member

No description provided.

The function returns if the type is 'READ' so the else statment was not
really necessary.
The retry logic was a bit ugly. Much of it looked like a poor mans
exponential backoff so stole a function from Jordan Sissel and modified
it slightly to improve the implementation and reduce code duplication:

https://github.com/jordansissel/experiments/blob/master/randomcode/exponential-backoff.c

Many of the waits seemed arbitrary and unfortunately, do not line up
exactly when using an exponential backoff. These changes will retry
things more often and could increase the overall time in which things
wait before giving up on retrying but only by 5 seconds at the most.

The biggest add in time (5 seconds) is in SendMSG() which is used quite
heavily throughout the code so the additional few seconds could have
some impact but it is difficult to say how much. There hopefully should
be none but it's worth noting. Most of the code will actually call
SendMSG() twice should the first call not result in the message being
sent which means most things are able to wait a decently long time in
order to get their message sent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant