Did you decide to write a WaitGroup because you got a channel or goroutines for some reason?
Golang
What does the Go convention say about using WaitGroup and return types (accept interfaces, return concrete types)?
Do you have any questions for me?
In a worker goroutine, can you describe what you use to read from the channel?
Can a goroutine write directly to another goroutine with a buffered channel?
Do you want to write a classic worker pool?
What technology/tool do you use?
What index types are used in PostgreSQL besides B-tree?
What was your role in making architectural decisions when developing the search service?
// The client passes an object (Task) with data for executing a task, // in our example, we will use an empty structure. // // The handler can process no more than N tasks simultaneously, // and no more than X tasks can be queued for processing. // If there is no space in the queue, immediately return an error to the client. // // A task is taken for processing if there are free handlers available. // We simulate processing duration with time.Sleep(5*time.Second). // As soon as one task is completed, we take the next task from the queue. // If the queue is empty, we wait for new tasks from clients. // // With a star: extend the Task structure and get task statuses through a separate request package scheduler type Scheduler interface { AddTask(t Task) error Close() } type scheduler struct { queue chan Task wg sync.WaitGroup } func New(workers, queue int) Scheduler { } type Task interface { Do() }
func New(workers, queue, int) Scheduler { s := &scheduler { queue := make(chan Task, queue) for i := 0; i < workers; i++ { wg.Add(1) go func() { defer wg.Done() for task := range s.queue { task.Do() } }() } } return s } func (s *scheduler) Close() { close(s.queue) s.wg.Wait() } type Task interface { Do() }
Have you used CTE? Tell me what it is.
If we want to handle errors occurring in tasks externally, how could we do it?
Have you used contexts in practice? Tell us.
Is work only permitted within the territory of the Russian Federation?
What is the difference between SELECT FOR UPDATE and SELECT FOR SHARE?
Is it possible to create an index only on a replica, but not on the master?
Are there still data races in the implementation? Specifically in the Keys method that returns a slice of keys?
Types of replication in PostgreSQL
Do you have experience writing Kubernetes operators, managing operators, Helm Charts?