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

Update routes to limit range to 30 days #118

Merged
merged 2 commits into from
Mar 5, 2024
Merged

Update routes to limit range to 30 days #118

merged 2 commits into from
Mar 5, 2024

Conversation

mpgxvii
Copy link
Member

@mpgxvii mpgxvii commented Mar 5, 2024

Copy link
Member

@yatharthranjan yatharthranjan left a comment

Choose a reason for hiding this comment

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

Please find a comment below. Can you also add the link to the documentation that states a limit of 30 days on these endpoints?


public class FitbitBreathingRateRoute extends FitbitPollingRoute {
private final FitbitBreathingRateAvroConverter converter;
protected static final Duration REQUEST_INTERVAL = Duration.ofDays(30);
Copy link
Member

Choose a reason for hiding this comment

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

I would rename this to THIRTY_DAYS and put it in the top level class, then it can be returned in downstream classes getDateRangeInterval() function. That way you don't have to define it more than once and make the code more readable.

@yatharthranjan
Copy link
Member

From what i can see, seems like we don't request for more than 30 days in a single request anyways?

Copy link
Member

@yatharthranjan yatharthranjan left a comment

Choose a reason for hiding this comment

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

LGTM (let's do some final testing in stage).

@mpgxvii
Copy link
Member Author

mpgxvii commented Mar 5, 2024

From what i can see, seems like we don't request for more than 30 days in a single request anyways?

Oh I was thinking if the start date was > than 30 days before today, it would be the case? One of the users reported these logs:

WARN Failed to make request FitbitRestRequest{url=https://api.fitbit.com/1/user/[]/hrv/date/2023-04-19/2024-03-05/all.json, user=LocalUser{id='[]', version='2023-04-20T14:00:27.807529715Z

@yatharthranjan
Copy link
Member

oh ok, could be the case. But we also see these same logs in our connector (which is not collecting any of these endpoints), so not sure what causes it. Maybe we need better reporting of failed requests in the logs (like the code, message, etc returned from failed HTTP request to determine the root cause).

This is a worthy feature update regardless, so i would proceed to merge.

@mpgxvii mpgxvii merged commit 35da8f1 into dev Mar 5, 2024
5 checks passed
@mpgxvii mpgxvii deleted the fix-fitbit-routes branch March 5, 2024 15:46
@mpgxvii mpgxvii mentioned this pull request Apr 17, 2024
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.

2 participants