From 177f7b3d1d48244fc39c2f23829cb2f27f589b7b Mon Sep 17 00:00:00 2001 From: Marcel Lanz Date: Sat, 13 Jun 2020 17:24:06 +0200 Subject: [PATCH] [fix go#27] remove the entity context for a cancelled stream. --- cloudstate/cloudstate.go | 2 +- cloudstate/eventsourced.go | 6 ++++++ tck/cmd/tck_shoppingcart/shoppingcart.go | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cloudstate/cloudstate.go b/cloudstate/cloudstate.go index 404851f..e2676d0 100644 --- a/cloudstate/cloudstate.go +++ b/cloudstate/cloudstate.go @@ -33,7 +33,7 @@ import ( ) const ( - SupportLibraryVersion = "0.1.0" + SupportLibraryVersion = "0.1.1" SupportLibraryName = "cloudstate-go-support" ) diff --git a/cloudstate/eventsourced.go b/cloudstate/eventsourced.go index f8580d2..72fc0b1 100644 --- a/cloudstate/eventsourced.go +++ b/cloudstate/eventsourced.go @@ -147,6 +147,12 @@ func (esh *EventSourcedServer) registerEntity(ese *EventSourcedEntity) error { func (esh *EventSourcedServer) Handle(stream protocol.EventSourced_HandleServer) error { var entityId string var failed error + + // "fix" for https://github.com/cloudstateio/go-support/issues/27 + // v0.2.x will contain the proper handling for the case of a closed stream. + defer func() { + delete(esh.contexts, entityId) + }() for { if failed != nil { return failed diff --git a/tck/cmd/tck_shoppingcart/shoppingcart.go b/tck/cmd/tck_shoppingcart/shoppingcart.go index 720edde..44270d6 100644 --- a/tck/cmd/tck_shoppingcart/shoppingcart.go +++ b/tck/cmd/tck_shoppingcart/shoppingcart.go @@ -34,7 +34,7 @@ import ( func main() { server, err := cloudstate.New(cloudstate.Config{ ServiceName: "shopping-cart", - ServiceVersion: "0.1.0", + ServiceVersion: "0.1.1", }) if err != nil { log.Fatalf("CloudState.New failed: %v", err)