Nicolas Martyanoff on Nostr: npub1fzx00…wt6h3 The Go runtime handles IO events. Goroutines yield on IO and ...
npub1fzx00c36ny4whyuhg4ykx6987wxp885fmwmc784n27qcu6pavwzs3wt6h3 (npub1fzx…t6h3) The Go runtime handles IO events. Goroutines yield on IO and function calls (and IIRC regularly to avoid having long computation not using functions hog a core). From your perspective, IO functions block execution, but in reality they just block the current goroutine while others will continue to execute.
So no risk of having inactive sockets blocking your entire server, no callback hell, all computations where some parts require IO are layed down linearly, errors are handled where they are triggered, etc.
This is the right way to do concurrency; Go and Erlang are the only two major languages to do it.
Published at
2024-02-17 12:49:10Event JSON
{
"id": "a77656d3bb920c1b252cbce3d3f6ec8b5bdd924df2ea026c9f081c03ff6397b8",
"pubkey": "f320bdda416aa99f2ae0949dca56c3bf58a9815c9de7ba950ad1fa568da2b816",
"created_at": 1708174150,
"kind": 1,
"tags": [
[
"p",
"488cf7e23a992aeb939745496368a7f38c139e89dbb78f1eb357818e683d6385",
"wss://relay.mostr.pub"
],
[
"p",
"584b9282fbc3d56bde321066766c0ebca3c5508e8d1596a8c7f0a15ca830571c",
"wss://relay.mostr.pub"
],
[
"e",
"c9d8503eeff58d4ed47c1db1c38ff096f2da30750256002bd110f8afce54ff61",
"wss://relay.mostr.pub",
"reply"
],
[
"proxy",
"https://emacs.ch/users/galdor/statuses/111946901147871847",
"activitypub"
]
],
"content": "nostr:npub1fzx00c36ny4whyuhg4ykx6987wxp885fmwmc784n27qcu6pavwzs3wt6h3 The Go runtime handles IO events. Goroutines yield on IO and function calls (and IIRC regularly to avoid having long computation not using functions hog a core). From your perspective, IO functions block execution, but in reality they just block the current goroutine while others will continue to execute.\n\nSo no risk of having inactive sockets blocking your entire server, no callback hell, all computations where some parts require IO are layed down linearly, errors are handled where they are triggered, etc.\n\nThis is the right way to do concurrency; Go and Erlang are the only two major languages to do it.",
"sig": "549f8b82c9483981e7dbec02a6b30e8cfbae104966b9d5c4707d94d7a6c41ef92f54fc8fe586206948dfbbe607b2bdd5902d7d8901125c0ec0096ebb7e64f519"
}