Skip to content

Commit de05a2c

Browse files
authored
Fix goroutine leak when backend isn't using continuation tasks
1 parent cc7b798 commit de05a2c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

internal/workflow/cache.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ func (c *workflowExecutorCache) Store(ctx context.Context, instance core.Workflo
5151
c.mu.Lock()
5252
defer c.mu.Unlock()
5353

54+
if instance, ok := c.cache[getKey(instance)]; ok {
55+
// Close existing executor to prevent leaks
56+
instance.executor.Close()
57+
}
58+
5459
c.cache[getKey(instance)] = &workflowExecutorCacheEntry{
5560
executor: executor,
5661
lastAccess: time.Now(),

0 commit comments

Comments
 (0)