-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(node): Make sure we use same ID for checkIns #8050
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,15 +38,26 @@ export interface SerializedCheckIn { | |
}; | ||
} | ||
|
||
export interface CheckIn { | ||
interface InProgressCheckIn { | ||
// The distinct slug of the monitor. | ||
monitorSlug: SerializedCheckIn['monitor_slug']; | ||
// The status of the check-in. | ||
status: SerializedCheckIn['status']; | ||
status: 'in_progress'; | ||
} | ||
|
||
interface FinishedCheckIn { | ||
// The distinct slug of the monitor. | ||
monitorSlug: SerializedCheckIn['monitor_slug']; | ||
// The status of the check-in. | ||
status: 'ok' | 'error'; | ||
// Check-In ID (unique and client generated). | ||
checkInId?: SerializedCheckIn['check_in_id']; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to make the ID required for FinishedCheckIns? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Honestly, why the hell do we need both an ID and a name?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It makes the DX worse, so no. This is because technically an ID can be undefined if the client is disabled (so the first
It's because you can have multiple crons with the same name fire at the same time, the id helps make sure that this works. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to explain the point I was making here because I think you misunderstood me here: For the finished checkins we theoretically don't need to send the id AND the slug since we can already map from id to slug in the product. I still stand by my point that we should not be required to send both but I'll approve this to unblock so that our current implementation is not busted. |
||
// The duration of the check-in in seconds. Will only take effect if the status is ok or error. | ||
duration?: SerializedCheckIn['duration']; | ||
} | ||
|
||
export type CheckIn = InProgressCheckIn | FinishedCheckIn; | ||
|
||
type SerializedMonitorConfig = NonNullable<SerializedCheckIn['monitor_config']>; | ||
|
||
export interface MonitorConfig { | ||
|
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.
You could theoretically call captureCheckIn with status "in_progress" but not provide a checkInId. We should couple those types. Not coupling would be very opaque for users why things are not working.
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.
yup refined with 33fd221
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.
I think that commit is on the wrong branch
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.
🤦