1414# See the License for the specific language governing permissions and
1515# limitations under the License.
1616
17- from . import service , handler , VTNService
1817import asyncio
19- from openleadr import utils , errors , enums
2018import logging
19+
20+ from openleadr import utils , errors , enums
21+ from . import service , handler , VTNService
22+
2123logger = logging .getLogger ('openleadr' )
2224
2325
@@ -28,7 +30,7 @@ def __init__(self, vtn_id, polling_method='internal'):
2830 super ().__init__ (vtn_id )
2931 self .polling_method = polling_method
3032 self .events = {}
31- self .completed_event_ids = {} # Holds the ids of completed events
33+ self .completed_event_ids = {} # Holds the ids of completed events
3234 self .event_callbacks = {}
3335 self .event_opt_types = {}
3436 self .event_delivery_callbacks = {}
@@ -41,7 +43,7 @@ async def request_event(self, payload):
4143 ven_id = payload ['ven_id' ]
4244 if self .polling_method == 'internal' :
4345 if ven_id in self .events and self .events [ven_id ]:
44- events = utils .order_events (self .events [ven_id ])
46+ events = utils .order_events (self .events [ven_id ]. copy () )
4547 for event in events :
4648 event_status = utils .getmember (event , 'event_descriptor.event_status' )
4749 # Pop the event from the events so that this is the last time it is communicated
0 commit comments