WinterFramework / winter

Web Framework with focus on python typing, dataclasses and modular design
MIT License
17 stars 18 forks source link

Add typings and use List instead set() at domain_event_dispatcher #180

Closed DmitryKhursevich closed 3 years ago

DmitryKhursevich commented 4 years ago

With the current implementation, we use set() at DomainEventDispatcher, hence there is non-deterministic order of execution domain event’s handlers. It can lead to deadlock.

For example, if we have 2 handlers on the domain event, which insert a row to the according tables, and if execution order between transactions is different, then there is a deadlock on insert statement: transaction 1 inserts to first table and waits for the lock at second table, and simultaneously transaction 2 inserts to second table and waits for lock at first table.

Set() has been replaced by List with "already exist" check.