Catman...imeout(3pm)

πŸ“¦
version 1.2025 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– Catman...imeout(3pm) πŸ’–

okay bestie, so this is Catmandu::Fix::Bind::timeout, and it lives in the User Contributed Perl Documentation section (that's the 3pm part, iykyk) ✨


🌸 NAME 🌸

Catmandu::Fix::Bind::timeout β€” it runs fixes that should run within a time limit, no cap πŸ•


πŸŽ€ SYNOPSIS πŸŽ€

# The following bind will run fix1(), fix2(), ... fixN() only if the
# action can be done in 5 seconds
do timeout(time:5, units:seconds)
   fix1()
   fix2()
   fix3()
   .
   .
   .
   fixN()
end

next_fix()

like literally just wrap your little fix squad in a do timeout(...) block and they only get to do their thing if they can do it inside the clock β³πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

The timeout binder will run the supplied block only when all the fixes can be run within a time limit. That's the whole vibe, fr fr.

And the part that's giving very much important: all fixes (except side-effects) are ignored when the block can't be executed within the time limit. ignored. gone. not happening. πŸ™ˆ


✨ CONFIGURATION ✨

⭐ timeout(time => VALUE , units => MICROSECOND|MILLISECONDS|SECONDS|MINUTES|HOURS)

Set a timeout to VALUE.

listen up bestie, this is the key detail: this timeout doesn't prevent a fix script to run longer than the specified value β€” but it does prevent fixes to have any effect when the timeout has been reached. two very different things, don't mix them up πŸ’€
# This script will run 10 seconds
do timeout(time:5, units:seconds)
   add_field(foo,ok) # This will be ignored
   sleep(10,seconds)
   set_field(foo,error) # This will be ignored
end

see how it still runs the full 10 seconds?? but those add_field and set_field calls get straight up ignored because the 5 second timeout already hit. the script keeps going, the effects do not. that's the whole point, iconic behavior honestly πŸ‘‘

At timeout a log message of level WARN will be generated. so you'll get a lil heads up in your logs, you won't be left guessing 🫢


🌈 SEE ALSO 🌈

  • Catmandu::Fix::Bind β€” the parent bind situation, go read it too bestie

that's the whole page, periodt πŸ’œ

oh and before I forget β€” this was put together with perl v5.40.1, dated 2026-01-24, and it's the Catman...imeout(3pm) page from the User Contributed Perl Documentation crew. love that for us, mwah πŸŽ€πŸ’–

πŸ“¦ where this page comes from