github.com/asynkron/protoactor-go@v0.0.0-20240308120642-ef91a6abee75/persistence/protocb/writer.go (about) 1 package protocb 2 3 import ( 4 "time" 5 6 "github.com/asynkron/protoactor-go/actor" 7 ) 8 9 type write struct { 10 fun func() 11 } 12 13 func newWriter(rate time.Duration) func(actor.Context) { 14 return func(context actor.Context) { 15 switch msg := context.Message().(type) { 16 case *write: 17 go msg.fun() 18 // time.Sleep(rate) 19 } 20 } 21 }