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
jynus commented 2023-08-19 13:37:18 +02:00 (Migrated from github.com)

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

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
antonio-gg-dev (Migrated from github.com) approved these changes 2023-08-21 22:47:36 +02:00
issork commented 2023-09-08 09:36:42 +02:00 (Migrated from github.com)

Looks good to me. Thanks!

Looks good to me. Thanks!
Sign in to join this conversation.
No description provided.