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

change to :os.system_time to avoid using invalid time while checking token expiry #169

Merged
merged 2 commits into from
Mar 17, 2024
Merged

change to :os.system_time to avoid using invalid time while checking token expiry #169

merged 2 commits into from
Mar 17, 2024

Conversation

rajrajhans
Copy link
Contributor

currently System.system_time is used to get current time, which is used for checking whether the token is expired. System.system_time is affected by time warp

note that the lag between :os.system_time and System.system_time was a lot in my case

iex(..)11> :os.system_time(:second) - System.system_time(:second)
96776

due to this, Goth.fetch returns expired tokens which are no longer valid. the only solution when this happens is to reboot the system. This PR changes it to use :os.system_time.

@wojtekmach
Copy link
Collaborator

Thank you for the PR. We had a similar PR before, #158, and I didn't realise there were leftovers. Could you while at it change all the other System.system_time occurrences when it makes sense? Also could you use System.os_time instead? Thank you!

@rajrajhans
Copy link
Contributor Author

hey @wojtekmach, I have updated the PR. Thanks for the quick response!

@wojtekmach wojtekmach merged commit 4b88576 into peburrows:master Mar 17, 2024
2 checks passed
@wojtekmach
Copy link
Collaborator

Thanks!

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