Skip to content

Commit

Permalink
Use domain name in completeActivityByID instead of domainID (#520)
Browse files Browse the repository at this point in the history
* Use domain name in completeActivityByID instead of domainID

* rebase
  • Loading branch information
vancexu authored Jan 23, 2018
1 parent 4725ace commit b9c8eef
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 93 deletions.
4 changes: 2 additions & 2 deletions .gen/go/shared/idl.go

Large diffs are not rendered by default.

66 changes: 33 additions & 33 deletions .gen/go/shared/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions common/cache/domainCache.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type (
DomainCache interface {
GetDomain(name string) (*persistence.DomainInfo, *persistence.DomainConfig, error)
GetDomainByID(id string) (*persistence.DomainInfo, *persistence.DomainConfig, error)
GetDomainID(name string) (string, error)
}

domainCache struct {
Expand Down Expand Up @@ -95,6 +96,15 @@ func (c *domainCache) GetDomainByID(id string) (*persistence.DomainInfo, *persis
return c.getDomain(id, id, "", c.cacheByID)
}

// GetDomainID retrieves domainID by using GetDomain
func (c *domainCache) GetDomainID(name string) (string, error) {
info, _, err := c.GetDomain(name)
if err != nil {
return "", err
}
return info.ID, nil
}

// GetDomain retrieves the information from the cache if it exists, otherwise retrieves the information from metadata
// store and writes it to the cache with an expiry before returning back
func (c *domainCache) getDomain(key, id, name string, cache Cache) (*persistence.DomainInfo, *persistence.DomainConfig, error) {
Expand Down
6 changes: 3 additions & 3 deletions idl/github.com/uber/cadence/shared.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ struct RespondActivityTaskCanceledRequest {
}

struct RespondActivityTaskCompletedByIDRequest {
10: optional string domainID
10: optional string domain
20: optional string workflowID
30: optional string runID
40: optional string activityID
Expand All @@ -875,7 +875,7 @@ struct RespondActivityTaskCompletedByIDRequest {
}

struct RespondActivityTaskFailedByIDRequest {
10: optional string domainID
10: optional string domain
20: optional string workflowID
30: optional string runID
40: optional string activityID
Expand All @@ -885,7 +885,7 @@ struct RespondActivityTaskFailedByIDRequest {
}

struct RespondActivityTaskCanceledByIDRequest {
10: optional string domainID
10: optional string domain
20: optional string workflowID
30: optional string runID
40: optional string activityID
Expand Down
Loading

0 comments on commit b9c8eef

Please sign in to comment.