Skip to content
This repository has been archived by the owner on Mar 11, 2022. It is now read-only.

Commit

Permalink
[fix] Backport issues found with #67 (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcellanz authored Jan 12, 2021
1 parent ec5c76d commit 1131164
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cloudstate/discovery/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,9 @@ func (s *EntityDiscoveryServer) RegisterCRDTEntity(entity *crdt.Entity, config p
return fmt.Errorf("failed to resolveFileDescriptor for DescriptorConfig: %+v: %w", config, err)
}
s.entitySpec.Entities = append(s.entitySpec.Entities, &protocol.Entity{
EntityType: protocol.CRDT,
ServiceName: entity.ServiceName.String(),
EntityType: protocol.CRDT,
ServiceName: entity.ServiceName.String(),
PersistenceId: entity.ServiceName.String(), // make sure CRDT entities have unique keys per service
})
return s.updateSpec()
}
Expand Down
7 changes: 7 additions & 0 deletions cloudstate/eventsourced/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ func (c *Context) fail(err error) {
c.failed = err
}

func (c *Context) reset() {
c.events = nil
c.failed = nil
c.forward = nil
c.sideEffects = nil
}

func (c *Context) resetSnapshotEvery() {
c.shouldSnapshot = false
}
Expand Down
1 change: 1 addition & 0 deletions cloudstate/eventsourced/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ func (s *Server) handle(stream entity.EventSourced_HandleServer) error {
// see: https://github.com/cloudstateio/cloudstate/pull/119#discussion_r444851439
return fmt.Errorf("failed context was not reported: %w", r.context.failed)
}
r.context.reset()
msg, err := r.stream.Recv()
switch err {
case nil:
Expand Down

0 comments on commit 1131164

Please sign in to comment.