Skip to content

Fix potential race condition in OrderCacheService #94

@MikeLuDev

Description

@MikeLuDev

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

  • Attempt to update an order which doesn't already exist in the cache service

Expected behavior

  • This should be gracefully handled

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions