Jump to content
McKay Development


  • Content Count

  • Joined

  • Last visited

  1. I've applied this pull request https://github.com/DoctorMcKay/node-tf2/pull/17 on the fork i've created and my issue is solved. Would be great if you could merge it.
  2. manager.on('receivedOfferChanged', function (offer) { if (offer.state === TradeOfferManager.ETradeOfferState.Accepted) { delete(tf2.backpack); tf2 = new TeamFortress2(client); client.gamesPlayed([440], true); } }); Didn't make any difference, I guess. I don't know how to properly catch memory leaks but I guess there's something to do with the lib itself. Snapshot 1 is taken while the bot is in idle state, TF2 client was initialized and then killed. (95MB) Snapshot 2 is taken after the bot has finished processing an offer and initialized a new tf2 client (deleted tf2.backpack before that), ran the currencyMaintainer, killed 440. (139MB) Snapshot 3 is the same cycle as snapshot 2. (150MB, ~11MB diff)
  3. I can send you my full source if needed, however; everything is fine if i reinitialize the tf2 class just before starting 440 again: Is there anything we can do to fix the memory leak? I'm almost sure it's not caused on my end because I didn't experience any memory leaks before doing this. (The bot ran like that for like 4 months without restarting on limited resources)
  4. I did try after posting that message, forgot to inform you; sorry. It seems I'm not connected to GC after restarting the 440, I've tried to run my currencyMaintain function with itemAcquired and itemRemoved events but they won't get triggered anymore after restarting 440. (Same situation with backpackLoaded event)
  5. It's not about the inventory contents, TF2 client should be initialized properly in order to use the craft method, right? Can I still use the craft method after killing and restarting the 440, while it didn't emit the backpackLoaded event for the second time? Additionally, backpackLoaded gets triggered if I reinitialize the tf2 class just before relaunching 440 but I get like ~+25MB memory leak which is caused by the lib (I guess) every time I do this. (not on a new variable, I overwrite the variable which is declared on the global scope)
  6. Here, the bot started the TF2 client on the initial launch and it triggered the backpackLoaded event. currencyMaintain class did it's job as we can see with "2020-02-06 13:27:28: ℹ info Smelting 1 refined to obtain 3 reclaimed (current reclaimed: 3)" After that, the bot stopped playing TF2 which is what I wanted. I took some metals from the bot's inventory so the currencyMaintain class will work when backpackLoaded gets triggered but it does not get triggered even it did launch the TF2 client again with the receivedOfferChanged event.
  7. Hello there, I couldn't see the section for node-tf2 so I'm creating the thread in here, sorry. I wrote something to prevent my trading bot's metal stock from running out. When an offer gets accepted, the bot should launch tf2 and do crafting then kill all running games in order to minimize the effect on the playtime stats. manager.on('receivedOfferChanged', function (offer) { if (offer.state === TradeOfferManager.ETradeOfferState.Accepted) { client.gamesPlayed([440], true); } }); let currMaintainCalled = false; // defined on the global scope on the initial execution let lastBpCall = 0; // defined on the global scope on the initial execution tf2.on('backpackLoaded', function () { if (moment().diff(lastBpCall, 'seconds') > 1) { if (initSeq.tf2.Client && tf2.backpack && !currMaintainCalled) { lastBpCall = moment(); let maintain = new currencyMaintain(tf2, config.get('app').behaviour.currencyMaintain.tf2, logger, currMaintainCalled); currMaintainCalled = true; maintain.Maintain(); client.gamesPlayed([], true); } } }); Since backpackLoaded can get emitted more than one time in a short period of time, i've added an epoch cooldown which is 1 second. tf2 class is initialized on the global scope. So, when the bot completes an offer; TF2 should be launched and backpackLoaded should get triggered but after TF2 launches, backpackLoaded doesn't get triggered. However, backpackLoaded does get triggered and currencyMaintainer class does it's job when I launch TF2 on the initial Steam login but it doesn't get triggered after i kill TF2 with client.gamesPlayed([]); and start the TF2 client again.
  • Create New...