Lars Wirzenius on Nostr: I have known at least since the mid-1990s that a "sleep 1" in a test suite to make ...
I have known at least since the mid-1990s that a "sleep 1" in a test suite to make sure a background process has time to run before I check that it has done its thing, is not reliable. It's a trap. It's a test failure waiting to happen.
I keep doing that. I keep getting caught in the trap.
The better pattern is to "wait for up to quite a long time and keep checking if the background process has done its thing every so often, but not to often". That's just more work to implement.
Published at
2024-08-26 18:20:46Event JSON
{
"id": "734e9222901b5258b029fa3a4fbc42a928e64e13b5c2500165f3a79b65caed02",
"pubkey": "b10dc1f389e232d431638f9ab5e479818b1bfab197d62e420c170baf0bec09cb",
"created_at": 1724696446,
"kind": 1,
"tags": [
[
"proxy",
"https://toot.liw.fi/users/liw/statuses/113029706330427610",
"activitypub"
]
],
"content": "I have known at least since the mid-1990s that a \"sleep 1\" in a test suite to make sure a background process has time to run before I check that it has done its thing, is not reliable. It's a trap. It's a test failure waiting to happen.\n\nI keep doing that. I keep getting caught in the trap.\n\nThe better pattern is to \"wait for up to quite a long time and keep checking if the background process has done its thing every so often, but not to often\". That's just more work to implement.",
"sig": "c0530c0e047f52e9910658da5311c1009e8f3afff31fe76ca83eb3c9e12d8e71f1d5d8e44f43dde0778296647be9f557328b03fefad0dfa186f4429216387183"
}