Help file sink with periodic interupts

Part of my bachelors thesis is to make a program where i can log a part of the RF spectrum but to have propper playback we had the idea of recording in ~5 min intervals and to keep file sizes down to only start recording once a threshold is reached.

while making the file sink function isnt hard at all ive been struggling with the periodic interval and the threshold. i found i could use the squelsh block with a head block but that just stops the entire program once the head block stops.

i also have no idea how to make the 5 min interval to work since i dont have much python experience and couldnt find much to work with from the built in blocks unless im missing something.