run the users-refresher-lambda
every minute
#123
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://trello.com/c/RIfC9Vqc/550-run-pinboard-user-refresher-lambda-on-permission-change
Previously the
users-refresher-lambda
ran on a 6 hourly schedule (to keep load on google APIs low), which kept our list of users (needed for name resolution, avatars and to populate the mentions suggestions) somewhat up to date. However the recent live blog pilots highlighted the fact that we still needed to run this lambda manually after a permission change to avoid waiting up to 6 hours before users could safely use pinboard.Initially we hoped to trigger the
users-refresher-lambda
whenever permissions actually change (see #118) however without adding lots of complex infrastructure (including making changes to guardian/permissions) this is not possible.What does this change?
Instead, here we increase the frequency of the
users-refresher-lambda
schedule to every minute and with a payload of{isProcessPermissionChangesOnly: true}
which checks there are actually pinboard permission changes and looks-up only those against the Google APIs. Note that users who have the permission removed are marked asisMentionable: false
We also introduce another schedule, which daily does a full run to ensure users who've left are marked as
isMentionable: false
.Mention suggestions are now only populated with users with
isMentionable: true
. This new approach replaces the previous TTL concept (see #46 and #50) and retains user rows indefinitely, preferring a flag which is more explicit (and also makes the impending move away from Dynamo to a relational DB easier).How to test
With this deployed to CODE
NO CHANGE TO PINBOARD PERMISSIONS, exiting early
in the logsDETECTED PINBOARD PERMISSIONS ADDED FOR
in the logs (followed by the usual log lines about upserting).DETECTED PINBOARD PERMISSIONS REMOVED FOR
in the logs (followed by the usual log lines about upserting).FULL RUN
in the logs (followed by the usual log lines about upserting).How can we measure success?
No dev intervention required when CP add new users to pinboard, and they can start using pinboard safely within a minute.
Have we considered potential risks?
This will cost a touch more, but since pinboard currently costs only a few cents per month - this is OK.