💾 Archived View for station.martinrue.com › clseibold › cf90a6c305cf401d8a6b9787a8d1d5c3 captured on 2024-07-09 at 01:41:43. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2024-05-26)

➡️ Next capture (2024-08-18)

🚧 View Differences

-=-=-=-=-=-=-

👽 clseibold

First time using semaphores in golang! They are really useful for limiting the number of concurrent connections being handled by a server. They are also really easy to understand - acquire 1 from the semaphore (locking if 1 is not available), and then release it when the connection is finished. Other people use channels, but channels are over-complicated for something as simple as this, imo.

For anyone wondering, I'm using this package: golang.org/x/sync/semaphore

7 months ago

Actions

👋 Join Station