Skip to content

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

Merged
wojtekmach merged 2 commits into
peburrows:masterfrom
rajrajhans:fix/invalid-skewed-time
Mar 17, 2024
Merged

change to :os.system_time to avoid using invalid time while checking token expiry#169
wojtekmach merged 2 commits into
peburrows:masterfrom
rajrajhans:fix/invalid-skewed-time

Conversation

@rajrajhans

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@wojtekmach

Copy link
Copy Markdown
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