Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: old orders (that no longer function) are still returned by Game.market.getAllOrders() #13

Open
maconard opened this issue Apr 28, 2021 · 1 comment

Comments

@maconard
Copy link

Bug situation:

There are orders that do not work (Game.market.deal returns OK, but the resources/credits never exchange). I tested some of these broken IDs one by one, making sure that the terminal had enough energy, there were enough credits, and no other deals were going on that tick.

What I think happened:

I had changed market.yml to sell only 200,000 of each resource instead of 1,000,000 of each resource (and also used admin-utils to wipe and re-spawn NPC Terminals), and the broken orders are all the old 1,000,000 ones, which still show in the in-client market UI and are returned by Game.market.getAllOrders(). Again, Game.market.deal on these orders returns OK but does not successfully complete.

I think the bug stems from the mod code not removing orders if the original terminals don't exist anymore, or some other variation of a dangling/orphan issue.

How I figured it out:

I added a blacklist array to my code that order IDs were added to after attempting them, and suddenly all my rooms were trading again after a few ticks (they swam through all the fake/busted orders). I have it temporarily fixed by filtering for orders <= 200000 amount, since all the 1000000 orders are the broken ones.

Cheers,

@maconard
Copy link
Author

The best fix for now is anytime you change amounts in market.yml and/or delete/re-spawn NPC Terminals, you should run storage.db['market.orders'].clear() in your server CLI and then re-start server. This will make sure all orphan orders get cleaned up and get a set of new orders from the active terminals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant