-
Notifications
You must be signed in to change notification settings - Fork 571
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
AI Attack & getSpellAbilityToPlay Timeout #6577
base: master
Are you sure you want to change the base?
Conversation
@kevlahnota about the AI timeout part, how about separating it into extra Threads per creature? threadSafeIterable would that change make problems for this ConcurrentModificationException? When Touching FCollection, how about looking at #3397 ? |
I changed the FCollection LinkedList to Lists.newCopyOnWriteArrayList() so it's already thread safe, threadSafeIterable returns the list directly from FCollection, also it uses Sets.newConcurrentHashSet(), (I think this is a shortcut to ConcurrentHashmap.newkeyset). |
I agree with @tool4ever's observations, and after these tweaks it looks like a very useful and nice option! :) |
I just thought we could clean up some code if we make: less own code means less errors ;P |
Isn't that going to be a massive hit to performance for a lot of the single-threaded code? |
I did profile it and seems ok so far. I don't know any concurrent list that is available. How does the change react to your machine when using it with lots of token/card generation? |
@Hanmac I encountered concurrent modification on Card.class for the Iterable getchangedcardtypes. Is it safe to return ImmutableList.copyOf instead of Iterables.unmodifiableIterable? |
I saw the error too on sentry but I can't explain it yet Do you got a case to reproduce that? If yes I could make a short hot fix |
Seems like a worthy trade-off. Performance is important but I think full support for the collection interface is more important for an implementation this widely used. |
move custom multimap implementation for floating mana since this only covers small section
update ManaPoolTest
@Hanmac @Agetian @tool4ever is there any changes needed? FCollection and ManaPool shouldn't throw ConcurrentModification anymore and seems to work fine. |
Well my main concern isn't really addressed: Also the "dumb check" you had to add clearly hints that something with your custom data alternative doesn't fully work and will break some existing AI behaviour. |
Ok I'll revert the Manapool and implement a lock similar to what I did to FCollection and remove the dumb check and restore the sort above it (I still think that's is the cause the of the issue) to satisfy your concern. |
remove ManaPoolTest for concurrency refactor timeout for chooseSpellAbilityToPlayFromList
👍 |
No description provided.