WowPacketParser icon indicating copy to clipboard operation
WowPacketParser copied to clipboard

Removed .Count and used methods inside DynamicUpdateField to loop over

Open matanshukry opened this issue 3 years ago • 6 comments

Removed .Count and used methods inside DynamicUpdateField to loop over

Solves #590

Note: While this implementation uses lock, the major thing is the refactor part of it where the implementation now lives in DynamicUpdateField class rather than outside of it, and can easily be changed.

matanshukry avatar Mar 06 '21 11:03 matanshukry

ConcurrentBag and/or BlockingCollection are your best friends.

Fabi avatar Mar 06 '21 16:03 Fabi

ConcurrentBag and/or BlockingCollection are your best friends.

Like I wrote in the note, the implementation isn't really important. I'm not familiar enough with the data to decide which method to use.

If thread A starts filling the values, and then threads B resizes it, should thread A still continue and fill the values? What if the size doesn't fit? And even if it still fits - is the data thread A has is still relevant, even though the size now isn't? which one should override? ...

matanshukry avatar Mar 06 '21 16:03 matanshukry

Not only thread A still needs to continue reading as many items from packets as it originally intended, older packets must not overwrite stored values from new packets (important for sql output)

Shauren avatar Mar 06 '21 16:03 Shauren

I'm assuming new packets can overwrite old packets (and should, otherwise their storage shouldn't be shared).

assuming we can have a "system" where new packets can overwrite data written by old packets, even in the middle of writing, what do we actually want to happen to the old packet?

  • Don't let new packet stop you. Finish first, then let new packet start writing & resizing.
  • Store a copy of the object with our own data and use that
  • Wait until the new packet finished overwriting the data and then use the new data
  • other?

@Shauren

matanshukry avatar Mar 07 '21 10:03 matanshukry

My idea was to make all properties on those classes nullable, have each packet operate on new object, store them in ConcurrentPriorityQueue then when time comes to output sql, merge them into single object

Anyway, no matter what we choose, it will require changes in the code generator for these parsers

Shauren avatar Mar 07 '21 11:03 Shauren

Suppression de .Count et méthodes utilisées dans DynamicUpdateField pour boucler

Résout #590

Remarque : Bien que cette implémentation utilise le verrou, l'essentiel est la partie refactorisation de celle-ci où l'implémentation vit maintenant dans DynamicUpdateFieldla classe plutôt qu'en dehors de celle-ci, et peut facilement être modifiée. packet wow is addon verified

Guldan45 avatar Aug 20 '22 15:08 Guldan45