Small refactor of the heartbeat call.#18
Merged
rafusel merged 1 commit intoadd-heartbeatfrom Jun 3, 2021
Merged
Conversation
ChezCrawford
commented
Jun 3, 2021
| httpResp, err := hb.client.Do(req) | ||
| if err != nil { | ||
| return 0, err | ||
| if !common.IsSuccessResponse(httpResp, err) { |
Author
There was a problem hiding this comment.
Makes use of the common success check.
ChezCrawford
commented
Jun 3, 2021
| } | ||
|
|
||
| func (hb *heartbeat) makeHeartbeatRequest() (int, error) { | ||
| func (hb *heartbeat) doHeartbeatRequest() (*heartbeatResponseBody, error) { |
Author
There was a problem hiding this comment.
Inner function is responsible for making the request and parsing the data. The outer function decides what to do with the resulting data (in this case, updating the heartbeat interval).
rafusel
approved these changes
Jun 3, 2021
Contributor
rafusel
left a comment
There was a problem hiding this comment.
Makes sense to me! I like this better for sure
rafusel
added a commit
that referenced
this pull request
Jun 4, 2021
* Add heartbeat initial commit. * FIxing a few loose ends. * Add max retry time. * Add changing heartbeat value with response. * Stop old ticker. * Remove max retry time check. * Generate heartbeat id on heartbeat start. * Remove "indirect". * Rename consts. * Rename heartbeatFrequency to frequency. * Change header. * Move heartbeat interface to heartbeat file. * Move error logging to beat(). * A bit more cleanup. * Move userAgent to common. * Move retry transport to common. * Update heartbeat to use RetryTransport. * Nitpicks. * Small refactor of the heartbeat call. (#18) * Make retry transport configurable. * Configure transport without constructor. Co-authored-by: Charlie Crawford <ccrawford@pagerduty.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.