"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.walletPnlTaskQueue=void 0;const console_1=require("@b/utils/console");class WalletPnlTaskQueue{constructor(){this.queue=[];this.processing=!1}async add(e){this.queue.push(e);if(!this.processing){this.processing=!0;await this.processQueue();this.processing=!1}}async processQueue(){for(;this.queue.length>0;){const e=this.queue.shift();if(e)try{await e()}catch(e){console_1.logger.error("WALLET","Error processing wallet PnL task",e)}}}}exports.walletPnlTaskQueue=new WalletPnlTaskQueue;