append async
This commit is contained in:
@@ -370,9 +370,13 @@ func (p *SimpleGrainPool[V]) Apply(id uint64, mutation proto.Message) (*V, error
|
|||||||
if applyErr := p.mutationRegistry.Apply(grain, mutation); applyErr != nil {
|
if applyErr := p.mutationRegistry.Apply(grain, mutation); applyErr != nil {
|
||||||
return nil, applyErr
|
return nil, applyErr
|
||||||
}
|
}
|
||||||
|
if p.storage != nil {
|
||||||
|
go func() {
|
||||||
if err := p.storage.AppendEvent(id, mutation); err != nil {
|
if err := p.storage.AppendEvent(id, mutation); err != nil {
|
||||||
log.Printf("failed to store mutation for grain %d: %v", id, err)
|
log.Printf("failed to store mutation for grain %d: %v", id, err)
|
||||||
}
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
return grain.GetCurrentState()
|
return grain.GetCurrentState()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user