VOLTTRON / volttron

VOLTTRON Distributed Control System Platform
https://volttron.readthedocs.io/
Other
452 stars 217 forks source link

Hot fix/UUID having extr chars #3134

Closed kefeimo closed 3 months ago

kefeimo commented 8 months ago

fixing https://github.com/VOLTTRON/volttron/issues/3132

Helper function to calculate unique uuids with minial char numbers. Mechanism: start common_len at 1, collect a pool of uuids represent by first common_len of its uuid, increase the number of common_len until the pool of uuids with heading common_len has unique members.

Example Process:

agent_ids = ['9b171ba5-f69f-4895-a69e-b51cf4d78150', '2c7c8405-49c8-48eb-86ff-236ebe39da6e', 'd73a71c8-000f-46aa-8e5f-c4436cf847c3', 'da2c1f0d-6ce5-4095-843c-3abc861d5199', 'f5de325c-e723-41e5-9ceb-fae722a40eb6']

round 1: common_length = 1 ["9", "2", "d", "d", "f"] , not unique, common_length += 1

round 2: common_length = 2 ["9b", "2c", "d7", "da", "f5"] , unique. Stop, common_length == 2