Is there an accepted best pattern for repeatedly running code until some timeout is reached?This is the pattern that we use at the moment, but putting conditions inside the while loop feels like there might be a way to put this into some kind of object that can be more easily inspected? Here's some code that we use at the moment
while (not_finished(draws, n_effective) & not_timed_out(start_time, time_limit)) { n_samples <- new_samples(draws, n_effective) draws <- extra_samples( draws, n_samples, verbose = verbose, one_by_one = one_by_one ) }
[#]rstats #rse #researchsoftwareengineering #pkgdev
=> More informations about this toot | View the thread | More toots from njtierney@aus.social
=> View rstats tag | View rse tag | View researchsoftwareengineering tag | View pkgdev tag This content has been proxied by September (3851b).Proxy Information
text/gemini