staratlasmeta / factory

Star Atlas Factory for constructing Transactions targeting Solana on-chain programs
https://www.npmjs.com/package/@staratlas/factory
Apache License 2.0
37 stars 15 forks source link

Fix potential race condition in OrderCacheService #94

Open MikeLuDev opened 2 years ago

MikeLuDev commented 2 years ago

Describe the bug

Context:

markets_1         | TypeError: Cannot read properties of undefined (reading 'get')
markets_1         |     at OrderCacheService.updateOrder (/usr/app/node_modules/@staratlas/factory/src/marketplace/services/OrderCacheService.ts:169:41)
markets_1         |     at GmOrderbookService.updateOrderInCache (/usr/app/node_modules/@staratlas/factory/src/marketplace/services/GmOrderbookService.ts:192:35)
markets_1         |     at GmOrderbookService.handleOrderModifiedEvent (/usr/app/node_modules/@staratlas/factory/src/marketplace/services/GmOrderbookService.ts:303:10)
markets_1         |     at GmOrderbookService.handleMarketplaceEvent (/usr/app/node_modules/@staratlas/factory/src/marketplace/services/GmOrderbookService.ts:320:14)
markets_1         |     at GmEventService.handleOrderExchanged (/usr/app/node_modules/@staratlas/factory/src/marketplace/services/GmEventService.ts:161:10)
markets_1         |     at /usr/app/node_modules/@project-serum/anchor/src/program/event.ts:110:17
markets_1         |     at Array.forEach (<anonymous>)
markets_1         |     at /usr/app/node_modules/@project-serum/anchor/src/program/event.ts:106:26
markets_1         |     at EventParser.parseLogs (/usr/app/node_modules/@project-serum/anchor/src/program/event.ts:182:9)
markets_1         |     at /usr/app/node_modules/@project-serum/anchor/src/program/event.ts:103:27

To Reproduce

Expected behavior