Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What about this?

    unsigned retry_count = 5;

    do {
        err = action ();
    } while (err && is_transient_error (err) && retry_count-- && (sleep (), TRUE))

    return err;
We want to loop while there is still an error, the error is still transient, we still haven't retried enough and after we have slept. Pretty straightforward translation of natural language to code.


Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: