Toot

Written by Nick Tierney on 2024-10-08 at 01:13

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

Mentions

Tags

=> View rstats tag | View rse tag | View researchsoftwareengineering tag | View pkgdev tag

Proxy Information
Original URL
gemini://mastogem.picasoft.net/toot/113269144888250796
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
224.218045 milliseconds
Gemini-to-HTML Time
0.503164 milliseconds

This content has been proxied by September (3851b).