AshIgorash Posted July 27 Report Posted July 27 I have a problem with saving correct data using method offer.data() If saving serverAck under await line then I got in pollData.json file the serverAck.finalState as false but in memory it is true because when logging it I got finalState = true. If I am calling this block over await line then everything is saved ok. this.trades.bot.tradeManager.on("sentOfferChanged",async (offer,oldState)=>{ logger.info(`Sent offer #${offer.id} state changed: ${oldState} -> ${offer.state}`) if(offer.id!==undefined){ const state = getStatus(offer.state) // this.socket.emit('offerChangedState',{state,offerId:offer.id}, (response)=>{ const response = await this.socket.emitWithAck('offerChangedState',{state,offerId:offer.id}) if(response.status === 'ok'){ let serverAck = offer.data("mainServerAcknowledged") as mainServerAck if(serverAck){ serverAck.finalState = true offer.data('mainServerAcknowledged',serverAck) console.log(offer.data("mainServerAcknowledged")) } } Quote
Dr. McKay Posted July 27 Report Posted July 27 Update to 2.11.5 and this should work properly. In previous versions it checks if the new value === the old value, which it would in this case since it's the same object reference. AshIgorash 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.