[PR #16366] [MERGED] Fixes #15194: Prevent enqueuing duplicate events for an object #14840

Closed
opened 2025-12-29 23:27:02 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/16366
Author: @jeremystretch
Created: 5/31/2024
Status: Merged
Merged: 6/3/2024
Merged by: @jeremystretch

Base: developHead: 15194-fix-duplicate-event-triggers


📝 Commits (1)

  • e53c212 Fixes #15194: Prevent enqueuing duplicate events for an object

📊 Changes

5 files changed (+57 additions, -40 deletions)

View changed files

📝 netbox/extras/context_managers.py (+4 -3)
📝 netbox/extras/events.py (+19 -13)
📝 netbox/extras/signals.py (+8 -21)
📝 netbox/extras/tests/test_event_rules.py (+25 -2)
📝 netbox/netbox/context.py (+1 -1)

📄 Description

Fixes: #15194

  • Change the events_queue context variable from a list to a dictionary, to enable identifying each object by a unique key.
  • Modify the logic within enqueue_object() to designate a unique key for each object in the events queue, instead of comparing each new object to the previous entry.
  • Remove the now-obsolete is_same_object() function.
  • Add a test for duplicate event triggers.

A huge thank you to @peteeckel for his thorough research into this issue and his initial work on a solution under PR #15318!


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/16366 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 5/31/2024 **Status:** ✅ Merged **Merged:** 6/3/2024 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `15194-fix-duplicate-event-triggers` --- ### 📝 Commits (1) - [`e53c212`](https://github.com/netbox-community/netbox/commit/e53c2127e50fa90069cf25afae64bcdbf0ae216f) Fixes #15194: Prevent enqueuing duplicate events for an object ### 📊 Changes **5 files changed** (+57 additions, -40 deletions) <details> <summary>View changed files</summary> 📝 `netbox/extras/context_managers.py` (+4 -3) 📝 `netbox/extras/events.py` (+19 -13) 📝 `netbox/extras/signals.py` (+8 -21) 📝 `netbox/extras/tests/test_event_rules.py` (+25 -2) 📝 `netbox/netbox/context.py` (+1 -1) </details> ### 📄 Description ### Fixes: #15194 - Change the `events_queue` context variable from a list to a dictionary, to enable identifying each object by a unique key. - Modify the logic within `enqueue_object()` to designate a unique key for each object in the events queue, instead of comparing each new object to the previous entry. - Remove the now-obsolete `is_same_object()` function. - Add a test for duplicate event triggers. A huge **thank you** to @peteeckel for his thorough research into this issue and his initial work on a solution under PR #15318! --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 23:27:02 +01:00
adam closed this issue 2025-12-29 23:27:02 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#14840