fix app events being registered multiple times

this would happen when two CCs processed the same DEA message, so we
just create it only if it's not already registered now

[finishes #48435601 #48705687]
Fix Ruby syntax warnings
Refactor dea_pool
Prefer to put app on DEA that has least instances of that app

[Finishes #47859269]