-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
feat: add utility to show experiment invitation notices #28120
Conversation
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.
Nice 👍
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.
😍
|
||
if (lastTimeWeShowedNotice) { | ||
if (Date.now() - lastTimeWeShowedNotice < minimumIntervalBetweenNoticesMs) { | ||
return undefined |
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.
if you return a noop function then you can avoid the check where it is called
- if (cancelNotice) {
- cancelNotice()
- }
+ cancelNotice()
This adds utility to help showing targeted experiment notices in CLI when some work takes more than predefined time threshold. To avoid potentially frustrating spam in CLI it tracks last time it showed that notice and will show it at most once a day (similar to how feedback survey doesn't show too often for same user).
For example usage see pieh@0316827 which would invite user to check out query on demand experiment if their page queries run for at least 2 minutes