Fix race condition exception by checking badge key exists #26

Merged
jynus merged 1 commits from cache_invalid_index into master 2023-09-08 09:36:29 +02:00

1 Commits

Author SHA1 Message Date
Jaime Crespo
554e32495e Fix race condition exception by checking badge key exists
Enabling disk_cache can lead to an exception (invalid_index)
when changing channel:

Invalid get index 'badge_sets' (on base 'Dictionary').
(gift_node.gd:525)

We short-circuit the get_badge_mapping (and also, as a side
effect, we lower the ciclomatic complexity of the method) so
that when there is a missing key the right thing happens.

This way we "return early" in the three cases: if it is cached
on memory, if it is cached on disk, or if we have to retrieve
it from Twitch/HTTPS.

Fixes #25
2023-08-19 13:31:19 +02:00