I have a program which has two threads: the first one, constantly receives data, the second one, once some data has been received, it processes it every 60 seconds.
Within this second thread, there's also a sort of 'debug' printing happening, which I need to slow down to 3 minutes in between prints.
This is roughly the pseudocode of what's happening:
def data_stream():
data.append(new_data)
def process_data():
data.update()
print(data)
time.sleep(60)
def main():
# I handle threading here
As you can see I want to add an if statement or something before the print to make sure that the printing is done once every 3 minutes. How can I do this?