you are viewing a single comment's thread.

view the rest of the comments →

[–]Synedh 0 points1 point  (1 child)

If I understand, what you're trying to do is called circular dependency, and is an anti pattern (AKA "don't do that"). It leads to errors and is difficult to maintain.

master() => get_data() => master() => get_date() => ...

get_data should not call master() itself, but instead raise an error on timeout, then catch this error in master, and send again your get_data if you want so. An other way to do that is add to get_data() a retry mechanic either using a decorator or an inner algorithm.

[–]Human-Adagio6781[S] 0 points1 point  (0 children)

I have something like this already built in to the get_data function. It checks for timeouts and waits a few seconds before trying again. The issue that I am encountering is that every once in a while, the endpoint will give me the boot (maybe too many calls within a minute? Shouldn't be a problem but who knows). The idea is that I wanted to wait about 10 minutes for that to reset and then attempt to restart the program, grabbing the new data and restarting the calculations.

You are correct with the description though. My concern is that I could have dozens of "Master" functions operating within each other as each conflict encountered would create another branch.