- Issue created by @shadysamir
We have a global flag "editor assignment" with a reference field to a user entity. Someone with the right permissions to use the flag can flag a node and select an assigned user (reference field). We noticed that some flagged nodes are repeated in a view.
Since we're using a relationship between the node and flagging to pull the assigned editor user name from the flagging reference field, we investigated the reason behind this in flagging context. Turns out in some random and impossible to properly reproduce cases more than one flagging entry is created with the same values, with a second to three seconds within each other. Here is sample result of a query from the database:
SELECT flagging.uid, flagging.global, from_unixtime(flagging.created) as created_utc, flagging.flag_id, flagging__field_assigned_editor.field_assigned_editor_target_id FROM flagging LEFT JOIN flagging__field_assigned_editor ON flagging__field_assigned_editor.entity_id = flagging.id WHERE flagging.entity_id = 13019 ORDER BY flagging.created;
+-----+--------+---------------------+-------------------+---------------------------------+
| uid | global | created_utc | flag_id | field_assigned_editor_target_id |
+-----+--------+---------------------+-------------------+---------------------------------+
| 23 | 1 | 2023-08-30 12:48:26 | editor_assignment | 23 |
| 23 | 1 | 2023-08-30 12:48:29 | editor_assignment | 23 |
| 23 | 1 | 2023-08-30 12:48:30 | editor_assignment | 23 |
| 23 | 1 | 2023-08-30 12:48:31 | editor_assignment | 23 |
+-----+--------+---------------------+-------------------+---------------------------------+
You can see that when uid 23 flagged the nid 13019 and chose himself as the referenced uid in assigned editor field, 4 flagging entities were created within 5 seconds.
As I mentioned in problem, this occurs randomly and we cannot fully reproduce it or make sure it will happen exactly like that every time. The most number of flaggings created was 4, the least and most common is 2. Out if 564 flagged nodes, 37 had this issue.
If you could guide me to what I need to do catch this when it happens to be able to investigate it further and find a solution.
Active
4.0
Flag core