go.temporal.io/server/service/frontend/overrides.go

58 LOC · 25 covered · 33 uncovered · 10 ranges · 334 concepts · 3 introducers · 153 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 package frontend
2
3 import (
4 "context"
5
6 "github.com/blang/semver/v4"
7 "go.temporal.io/api/workflowservice/v1"
8 "go.temporal.io/server/common/headers"
9 )
10
11 // Overrides defines a set of special case behaviors like compensating for buggy
12 // SDK implementations
13 type Overrides struct {
14 minTypeScriptEagerActivitySupportedVersion semver.Version
15 }
16
17 > func NewOverrides() *Overrides { overrides.go ×1
18 > return &Overrides{
19 > minTypeScriptEagerActivitySupportedVersion: semver.MustParse("1.4.4"),
20 > }
21 > }
22
23 > func (o *Overrides) shouldForceDisableEagerDispatch(sdkName, sdkVersion string) bool { overrides.go ×4
24 > if sdkName == headers.ClientNamePythonSDK && (sdkVersion == "0.1a1" || sdkVersion == "0.1a2" || sdkVersion == "0.1b1" || sdkVersion == "0.1b2") {
25 > return true overrides.go ×5
26 > } else if sdkName == headers.ClientNameTypeScriptSDK { overrides.go ×4
27 > ver, err := semver.Parse(sdkVersion) overrides.go ×5
28 > // Don't bother with non semver
29 > if err != nil {
30 return false
31 }
32 > return ver.LT(o.minTypeScriptEagerActivitySupportedVersion) overrides.go ×5
33 }
34 > return false overrides.go ×4
35 }
36
37 func (o *Overrides) disableEagerDispatch(
38 request *workflowservice.RespondWorkflowTaskCompletedRequest,
39 > ) { overrides.go ×5
40 > for _, cmd := range request.GetCommands() {
41 > attrs := cmd.GetScheduleActivityTaskCommandAttributes()
42 > if attrs != nil {
43 > attrs.RequestEagerExecution = false
44 > }
45 }
46 }
47
48 // DisableEagerActivityDispatchForBuggyClients compensates for SDK versions
49 // that have buggy implementations of eager activity dispatch
50 func (o *Overrides) DisableEagerActivityDispatchForBuggyClients(
51 ctx context.Context,
52 request *workflowservice.RespondWorkflowTaskCompletedRequest,
53 > ) { overrides.go ×4
54 > sdkName, sdkVersion := headers.GetClientNameAndVersion(ctx)
55 > if o.shouldForceDisableEagerDispatch(sdkName, sdkVersion) {
56 > o.disableEagerDispatch(request) overrides.go ×5
57 > }
58 }