Sobes.tech
Senior

Kas oli suurim või keerulisem ülesanne, mida soovite oma kogemusest välja tuua?

sobes.tech AI

Vastus AI-lt

One of the most challenging tasks was developing a high-load distributed service in Go, which handled millions of requests per day with minimal latency. The project required efficient management of goroutines, optimization of database operations, and ensuring system fault tolerance.

Example code for managing goroutines using context:

ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()

ch := make(chan string)
go func() {
    // simulate work
    time.Sleep(2 * time.Second)
    ch <- "result"
}()

select {
case res := <-ch:
    fmt.Println("Received result:", res)
case <-ctx.Done():
    fmt.Println("Timeout expired")
}