Skip to content
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

change events from reference to copy #176

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions openleadr/service/event_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from . import service, handler, VTNService
import asyncio
from openleadr import utils, errors, enums
import logging

from openleadr import utils, errors, enums
from . import service, handler, VTNService

logger = logging.getLogger('openleadr')


Expand All @@ -28,7 +30,7 @@ def __init__(self, vtn_id, polling_method='internal'):
super().__init__(vtn_id)
self.polling_method = polling_method
self.events = {}
self.completed_event_ids = {} # Holds the ids of completed events
self.completed_event_ids = {} # Holds the ids of completed events
self.event_callbacks = {}
self.event_opt_types = {}
self.event_delivery_callbacks = {}
Expand All @@ -41,7 +43,7 @@ async def request_event(self, payload):
ven_id = payload['ven_id']
if self.polling_method == 'internal':
if ven_id in self.events and self.events[ven_id]:
events = utils.order_events(self.events[ven_id])
events = utils.order_events(self.events[ven_id].copy())
for event in events:
event_status = utils.getmember(event, 'event_descriptor.event_status')
# Pop the event from the events so that this is the last time it is communicated
Expand Down
Loading