Skip to content

Commit

Permalink
fix: close stream for lease when lease expires (#2265)
Browse files Browse the repository at this point in the history
fixes #2215

When a module lease has an error (example ctx canceled due to the verb
call ending), it used to leave the stream with the controller open
forever. This change closes that stream.
  • Loading branch information
matt2e authored Aug 7, 2024
1 parent f1abb89 commit 10e3afc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions go-runtime/ftl/leases.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ func Lease(ctx context.Context, ttl time.Duration, key ...string) (LeaseHandle,
}
// Notify the handle.
logger.Warnf("Lease heartbeat terminated for %s: %s", leaseKeyForLogs(module, key), err)
if err := lease.client.Release(ctx, key); err != nil {
logger.Warnf("Could not close lease %s: %s", leaseKeyForLogs(module, key), err)
}
lease.state.open = false
lease.state.err = optional.Some(err)
return
Expand Down

0 comments on commit 10e3afc

Please sign in to comment.