-
Notifications
You must be signed in to change notification settings - Fork 51
Rewrite the last_ping
key again
#255
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
Rewrite the last_ping
key again
#255
Conversation
sessionFile.writeAsStringSync( | ||
'{"session_id": ${now.millisecondsSinceEpoch}, "last_ping": null}'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explanation for why I think this is necessary:
Package publishing
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. |
@@ -85,7 +85,8 @@ class Initializer { | |||
final now = sessionIdOverride ?? clock.now(); | |||
sessionFile.createSync(recursive: true); | |||
sessionFile | |||
.writeAsStringSync('{"session_id": ${now.millisecondsSinceEpoch}}'); | |||
.writeAsStringSync('{"session_id": ${now.millisecondsSinceEpoch}, ' | |||
'"last_ping": ${now.millisecondsSinceEpoch}}'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a comment here that its deprecated?
// Fallback to setting the session id as the current time | ||
_sessionId = now.millisecondsSinceEpoch; | ||
// ignore: avoid_catching_errors | ||
} on TypeError catch (err) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's not catch TypeError, and instead be disciplined about never deleting fields from this JSON file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes:
Not having the
last_ping
key in the session json file will cause issues if a user chooses to downgrade to a previous version of this package that attempts to parselast_ping
. This PR adds that value backContribution guidelines:
dart format
.Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.