-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Describe the bug
The events service is attempting to save an event entity multiple times due to the design of receiving the latest 100 events from the backend. This is non-blocking but could be reworked to first check the database for an existing event and throw out any. It would reduce overall application error load and reduce attempted writes to the database.
To Reproduce
Steps to reproduce the behavior:
- Run the application locally in debug mode with a clone of prod data
- Observe event errors such as the following:
Error occurred while saving event: {"neighborhood":{"id":6,"address":{"bytes":{"0":1,"1":161,"2":2,"3":0,"4":212,"5":249,"6":10,"7":35,"8":179,"9":247,"10":229,"11":197,"12":107,"13":141,"14":184,"15":208,"16":6,"17":158,"18":165,"19":37,"20":221,"21":75,"22":62,"23":142,"24":42,"25":181,"26":61,"27":112,"28":4}},"url":"https://alberto.app/api","name":"Manifest Alpha 2 (Current)","enabled":true,"description":null,"serverName":"AbciModule(many-ledger)","attributes":[0,1,2,4,5,6,8,[9,0,1],11,12,1002],"version":"0.0.0"},"eventId":{"type":"Buffer","data":[31,17,109,0,0,0,1]},"timestamp":"2024-07-16T07:35:49.000Z","method":"ledger.send","type":[6,0],"info":{"from":"mahxav47kqz4fvxv7dtfqln6vqjmoayc4v2zofeqeost3lnist","to":"mafk5xrtl6dmny2uvrrlc5ix2z3ucr7tcefwayzrfh4j25pi7m","symbol":"mqbh742x4s356ddaryrxaowt4wxtlocekzpufodvowrirfrqaaaaa3l","amount":"850000000"},"addresses":["mahxav47kqz4fvxv7dtfqln6vqjmoayc4v2zofeqeost3lnist","mafk5xrtl6dmny2uvrrlc5ix2z3ucr7tcefwayzrfh4j25pi7m","mqbh742x4s356ddaryrxaowt4wxtlocekzpufodvowrirfrqaaaaa3l"]}, QueryFailedError: duplicate key value violates unique constraint "UQ_4ee8fd974a5681971c4eb5bb585"
Expected behavior
Prior to saving, the events retrieved from the network endpoints should be queried to determine pre-existence in the database from previous runs. Save new ones, ignore existing ones.
Metadata
Metadata
Assignees
Labels
No labels