Update ChatName activity timestamp throttle
What does this MR do and why?
Updates ChatName activity timestamp throttle
As mentioned in #413368 (comment 1564173408), ChatName
records do not have their activity timestamp correctly
updated. This is due to an incorrect time comparison. This MR replaces
>
with .before?
, which should yield the correct result, and updates
the specs accordingly.
In addition, it removes the global lock on the chat name, as this behaviour duplicates the timezone check.
How to set up and validate locally
-
Create a chat name for one of your users in the GDK's Rails console:
user = User.first user.chat_names.create(chat_id: 1, team_id: 1)
-
Set up a Slack command integration in one of your projects and copy the hook URL.
-
Briefly update
ChatName::LAST_USED_AT_INTERVAL
to something like30.seconds
. -
In your terminal:
curl --request POST --header "PRIVATE-TOKEN: <your-pat-here>" \ --url "http://localhost:3000/api/v4/projects/7/integrations/slack_slash_commands/trigger?token=<your-token>&team_id=1&user_id=1"
-
Verify that
ChatName#last_used_at
has been updated. -
Run the
curl
command again immediately and verify that the timestamp is unchanged. -
Wait for the interval to elapse, re-run the curl command, and verify the new timestamp.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.