Matt Massicotte on Nostr: Here's an easy mistake to make: putting your weak self check at the beginning of a ...
Here's an easy mistake to make: putting your weak self check at the beginning of a Task body when iterating over an AsyncSequence.
Instead, you want to check within the for-await loop, so you don't tie the lifecycle of self to the potentially-infinite sequence.
Published at
2024-05-15 12:45:40Event JSON
{
"id": "3e32bf061d8bd4985a7d0beb889ce932bb9a28c81d07412435cdcd854347dbba",
"pubkey": "326c9100a3d1f1ecd0d35bf9590b2633e6c22a25debb08aac79d5af903bd8672",
"created_at": 1715777140,
"kind": 1,
"tags": [
[
"proxy",
"https://mastodon.social/users/mattiem/statuses/112445170710342008",
"activitypub"
]
],
"content": "Here's an easy mistake to make: putting your weak self check at the beginning of a Task body when iterating over an AsyncSequence.\n\nInstead, you want to check within the for-await loop, so you don't tie the lifecycle of self to the potentially-infinite sequence.\n\nhttps://files.mastodon.social/media_attachments/files/112/445/170/536/047/289/original/914acee5ec406b7e.png",
"sig": "5ae7b4a8b4413629d772e33b79470aead64149a58754ea601f6e7c5a6fa887fff628de123534f8a5b205061f32bebb6a93a9dcf3660ce865d1a0a517ca77c5d3"
}