Skip to content

Expose WorkflowLockTimeout and ActivityLockTimeout options - #404

Merged
cschleiden merged 3 commits into
mainfrom
copilot/fix-403
Aug 14, 2025
Merged

Expose WorkflowLockTimeout and ActivityLockTimeout options#404
cschleiden merged 3 commits into
mainfrom
copilot/fix-403

Conversation

Copilot AI commented Aug 14, 2025

Copy link
Copy Markdown
Contributor

This PR exposes the WorkflowLockTimeout and ActivityLockTimeout configuration options by adding corresponding With* option functions to the backend package.

Problem

The Options struct in backend/options.go already contained WorkflowLockTimeout and ActivityLockTimeout fields with default values (1 minute and 2 minutes respectively), but there was no way for users to customize these timeouts when creating backend instances. Users could only use the hardcoded default values.

Solution

Added two new option functions following the existing pattern:

func WithWorkflowLockTimeout(timeout time.Duration) BackendOption {
    return func(o *Options) {
        o.WorkflowLockTimeout = timeout
    }
}

func WithActivityLockTimeout(timeout time.Duration) BackendOption {
    return func(o *Options) {
        o.ActivityLockTimeout = timeout
    }
}

Usage

Users can now customize these timeouts when configuring backends:

import "github.com/cschleiden/go-workflows/backend"

opts := backend.ApplyOptions(
    backend.WithWorkflowLockTimeout(5*time.Minute),
    backend.WithActivityLockTimeout(10*time.Minute),
)

Testing

  • Added comprehensive unit tests covering individual usage, combined usage, and integration with existing options
  • Verified all existing tests continue to pass
  • Tested integration with monoprocess backend (12+ seconds of tests pass)
  • Confirmed the functions work correctly when imported from external packages

The changes are minimal and surgical - just 12 lines of new production code following the exact same pattern as existing option functions like WithStickyTimeout, WithLogger, etc.

Fixes #403.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: cschleiden <2201819+cschleiden@users.noreply.github.com>
Copilot AI changed the title [WIP] Expose WorkflowLockTimeout and ActivityLockTimeout options Expose WorkflowLockTimeout and ActivityLockTimeout options Aug 14, 2025
Copilot AI requested a review from cschleiden August 14, 2025 18:43
Comment thread backend/options.go
…ckTimeout options

- Add GoDoc comments for WithWorkflowLockTimeout and WithActivityLockTimeout functions
- Add both options to public documentation in _backends.md with default values
- Addresses review feedback on PR #403

Co-authored-by: cschleiden <2201819+cschleiden@users.noreply.github.com>
Copilot AI requested a review from cschleiden August 14, 2025 18:53
@cschleiden
cschleiden marked this pull request as ready for review August 14, 2025 20:03
@cschleiden
cschleiden enabled auto-merge August 14, 2025 20:05
@cschleiden
cschleiden merged commit 57fcb9a into main Aug 14, 2025
4 checks passed
@cschleiden
cschleiden deleted the copilot/fix-403 branch August 14, 2025 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose WorkflowLockTimeout and ActivityLockTimeout options

2 participants