Concurrently in Go
In this code, function fn()
should be executed 2 times every 200ms (the interval depends on the limit
value). How to limit the number of calls?
[Golang]: Goroutine cancelation mid-execution
I was watching the Rob Pike’s fascinating talk called “Concurrency is not Parallelism” and I was trying to extend the example with concurrent queries, but it seems that I don’t fully understand how goroutines work. In particular, I don’t understand how to cancel the goroutine during its execution.
Goroutines and Non-Concurrent Function Yield Same Runtime Despite Different Benchmark Results
I have a function that logs messages. When I run this function with and without the go keyword, I observe the following:
Goroutine inside function
I’ve read https://go.dev/blog/pipelines and there’re two functions:
Does errgroup in Go stop creating new goroutines when an error occurs in one of them?”
I have the following code:
Should I use goroutines for subflows or execute them sequentially in Go?”
The situation is the following: I have a web application in Go written with Gin (I think it doesn’t matter the framework). Then, as it is known, each incoming request is served by a goroutine. One of the endpoints has a flow in which a subflow must be done internally several times (from 45 to 500 times, usually closer to the lower limit). This subflow consists of three operations: an http request and aand two MongoDB operations. To continue with the main flow I have to wait for all the subflows to finish (they are done transactionally moreover, this I handle directly with the Mongo driver). So, according to me, I have 2 ways:
How can I launch several goroutines and obtain the result of each one separately?
I’m a little confused about the best way to use channels in Go. I am in a situation like this:
Data race on accessing designated indexes by go routines from a shared Array
I have this following program where I am trying to store some final results based on each go-routine and the trick I am using to not have race condition is by designating a particular array index for each go-routine.