You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
save chan ItemRequest
fetch chan Request
delete chan Request
func (s *KVStore) loop() {
for {
select {
case setRequest := <-s.save:
// set process
case getRequest := <-s.fetch:
// get process
case delRequest := <-s.delete:
// del process
}
}
}
This leads to a situation where save has bigger priority than fetch and might behave unexpectedly in corner case scenarios.
In order to further strengthen thread safety, it would be good to run a select loop on a single channel like a work unit.
func (s *KVStore) loop() {
for {
select {
case request := <-s.operations:
// unified process
}
}
}
Shape of the Request in operations chan Request is yet to be decided as mistakes here might lead to type safety issues. Obviously we dont want to trade thread safety for type safety.
Issue open for thoughts
The text was updated successfully, but these errors were encountered:
At the moment, we run 3 queues
This leads to a situation where
save
has bigger priority thanfetch
and might behave unexpectedly in corner case scenarios.In order to further strengthen thread safety, it would be good to run a
select
loop on a single channel like a work unit.Shape of the
Request
inoperations chan Request
is yet to be decided as mistakes here might lead to type safety issues. Obviously we dont want to trade thread safety for type safety.Issue open for thoughts
The text was updated successfully, but these errors were encountered: