You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
event_service.py request_event not working for only one event #175
I was setting up a VTN with the 1-minute-Server example from the docs and ran into a problem. As I am running my client in typescript I got a TypeError saying, that my oadrEvent that I got back from polling was not iterable.
The response message to the poll request from the vtn looks like this:
Responding to oadrPoll with a oadrDistributeEvent message:
pops the event not only from self.events but also from the referenced variable events, that is later used to fill the response array. And since the function later only checks if events is None, this results in giving back an empty array as a response.
I fixed this by adjusting line 46 where the reference is created and used the copy function to create a copy of self.events rather than a reference to it.
Hi Jiklas,
Thank you for debugging and fixing this, it does look like a bug. Were you
able to submit an issue or a pull request?
Let me know how I can support you.
Thanks,
Arila
On Fri, Nov 22, 2024 at 11:03 AM jiklas-nust ***@***.***> wrote:
Hi,
I was setting up a VTN with the 1-minute-Server example from the docs and
ran into a problem. As I am running my client in typescript I got a
TypeError saying, that my oadrEvent that I got back from polling was not
iterable.
The response message to the poll request from the vtn looks like this:
Responding to oadrPoll with a oadrDistributeEvent message: {'events': [],
'vtn_id': 'myvtn', 'ven_id': 'ven_id_123', 'response': {'request_id': None,
'response_code': 200, 'response_description': 'OK'}, 'request_id':
'8a23b069-bf08-4769-b9fd-e9b3cfbb94d9'}.
The array which would normally hold the events is empty IF we only have
one event in queue.
I cannot really explain why python does this, but when I debugged the
request_event function I saw, that
self.events[ven_id].pop(self.events[ven_id].index(event)) (line 55 in event_service.py)
pops the event not only from self.events but also from the referenced
variable events, that is later used to fill the response array. And since
the function later only checks if events is None, this results in giving
back an empty array as a response.
I fixed this by adjusting line 46 where the reference is created and used
the copy function to create a copy of self.events rather than a reference
to it.
events = utils.order_events(self.events[ven_id].copy())
Is this a real bug or am I missing something? I'm not too familiar with
python. I'd love to hear back from you with some advice.
—
Reply to this email directly, view it on GitHub
<#175>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIR5OPF3KM47FVDTPET6VPT2B3XNRAVCNFSM6AAAAABSI345QSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGY4DENBYGQ2DANY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
thanks for replying. Could you get me through the steps of submitting a pull request? Do I need to fork the repo in order to?
I tried creating a new branch but it won't let me push this branch to the remote.
It's my first contribution to a public repo so I'm a little bit lost here.
Activity
axmsoftware commentedon Nov 22, 2024
jiklas-nust commentedon Nov 22, 2024
Hi Arila,
thanks for replying. Could you get me through the steps of submitting a pull request? Do I need to fork the repo in order to?
I tried creating a new branch but it won't let me push this branch to the remote.
It's my first contribution to a public repo so I'm a little bit lost here.
Thanks, Jiklas