Skip to content

Commit 610051b

Browse files
committed
cleanup
1 parent 9e37aeb commit 610051b

File tree

5 files changed

+21
-35
lines changed

5 files changed

+21
-35
lines changed

internal/internal_event_handlers.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,6 @@ func (weh *workflowExecutionEventHandlerImpl) ProcessEvent(
943943

944944
historySum := weh.estimateHistorySize(event)
945945
weh.workflowInfo.TotalHistoryBytes += int64(historySum)
946-
weh.logger.Info("EstimateHistorySize", zap.Int("historyBytes", historySum), zap.Int64("totalHistoryBytes", weh.workflowInfo.TotalHistoryBytes))
947946

948947
// When replaying histories to get stack trace or current state the last event might be not
949948
// decision started. So always call OnDecisionTaskStarted on the last event.

internal/internal_task_handlers.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ const (
5151
defaultStickyCacheSize = 10000
5252

5353
noRetryBackoff = time.Duration(-1)
54-
55-
historySizeEstimationOffset = 1 * 100
5654
)
5755

5856
type (
@@ -271,7 +269,6 @@ func (eh *history) NextDecisionEvents() (result []*s.HistoryEvent, markers []*s.
271269
if len(result) > 0 {
272270
eh.next, markers, err = eh.nextDecisionEvents()
273271
}
274-
275272
return result, markers, checksum, err
276273
}
277274

@@ -832,7 +829,6 @@ func (w *workflowExecutionContextImpl) ProcessWorkflowTask(workflowTask *workflo
832829
if err := w.ResetIfStale(task, historyIterator); err != nil {
833830
return nil, err
834831
}
835-
836832
w.SetCurrentTask(task)
837833

838834
eventHandler := w.getEventHandler()
@@ -874,7 +870,6 @@ ProcessEvents:
874870
if err != nil {
875871
return nil, err
876872
}
877-
878873
if w.isWorkflowCompleted {
879874
break ProcessEvents
880875
}

internal/internal_task_pollers.go

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,15 @@ type (
110110
}
111111

112112
historyIteratorImpl struct {
113-
iteratorFunc func(nextPageToken []byte) (*s.History, []byte, error)
114-
execution *s.WorkflowExecution
115-
nextPageToken []byte
116-
domain string
117-
service workflowserviceclient.Interface
118-
metricsScope tally.Scope
119-
startedEventID int64
120-
maxEventID int64 // Equivalent to History Count
121-
featureFlags FeatureFlags
122-
totalHistoryBytes int64
113+
iteratorFunc func(nextPageToken []byte) (*s.History, []byte, error)
114+
execution *s.WorkflowExecution
115+
nextPageToken []byte
116+
domain string
117+
service workflowserviceclient.Interface
118+
metricsScope tally.Scope
119+
startedEventID int64
120+
maxEventID int64 // Equivalent to History Count
121+
featureFlags FeatureFlags
123122
}
124123

125124
localActivityTaskPoller struct {
@@ -331,7 +330,6 @@ func (wtp *workflowTaskPoller) processWorkflowTask(task *workflowTask) error {
331330
})
332331
return nil
333332
}
334-
// TODO: get workflowinfo
335333
doneCh := make(chan struct{})
336334
laResultCh := make(chan *localActivityResult)
337335
// close doneCh so local activity worker won't get blocked forever when trying to send back result to laResultCh.
@@ -856,15 +854,14 @@ func (wtp *workflowTaskPoller) toWorkflowTask(response *s.PollForDecisionTaskRes
856854
}
857855
}
858856
historyIterator := &historyIteratorImpl{
859-
nextPageToken: response.NextPageToken,
860-
execution: response.WorkflowExecution,
861-
domain: wtp.domain,
862-
service: wtp.service,
863-
metricsScope: wtp.metricsScope,
864-
startedEventID: startEventID,
865-
maxEventID: nextEventID - 1,
866-
featureFlags: wtp.featureFlags,
867-
totalHistoryBytes: response.GetTotalHistoryBytes(),
857+
nextPageToken: response.NextPageToken,
858+
execution: response.WorkflowExecution,
859+
domain: wtp.domain,
860+
service: wtp.service,
861+
metricsScope: wtp.metricsScope,
862+
startedEventID: startEventID,
863+
maxEventID: nextEventID - 1,
864+
featureFlags: wtp.featureFlags,
868865
}
869866
task := &workflowTask{
870867
task: response,
@@ -902,11 +899,6 @@ func (h *historyIteratorImpl) HasNextPage() bool {
902899
return h.nextPageToken != nil
903900
}
904901

905-
// GetTotalHistoryBytes returns History Size of current history
906-
func (h *historyIteratorImpl) GetTotalHistoryBytes() int64 {
907-
return h.totalHistoryBytes
908-
}
909-
910902
// GetHistoryCount returns History Event Count of current history (aka maxEventID)
911903
func (h *historyIteratorImpl) GetHistoryCount() int64 {
912904
return h.maxEventID

internal/workflow.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,13 +1161,13 @@ func (wc *workflowEnvironmentInterceptor) GetMetricsScope(ctx Context) tally.Sco
11611161
return wc.env.GetMetricsScope()
11621162
}
11631163

1164-
// GetTotalHistoryBytes returns the current history size of that workflow
1165-
func GetTotalHistoryBytes(ctx Context) int64 {
1164+
// GetTotalEstimatedHistoryBytes returns the current history size of that workflow
1165+
func GetTotalEstimatedHistoryBytes(ctx Context) int64 {
11661166
i := getWorkflowInterceptor(ctx)
11671167
return i.GetWorkflowInfo(ctx).TotalHistoryBytes
11681168
}
11691169

1170-
// GetHistoryCount returns the current number of events of that workflow
1170+
// GetHistoryCount returns the current number of history events of that workflow
11711171
func GetHistoryCount(ctx Context) int64 {
11721172
i := getWorkflowInterceptor(ctx)
11731173
return i.GetWorkflowInfo(ctx).HistoryCount

workflow/workflow.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func GetMetricsScope(ctx Context) tally.Scope {
219219

220220
// GetTotalHistoryBytes returns the current history size of that workflow
221221
func GetTotalHistoryBytes(ctx Context) int64 {
222-
return internal.GetTotalHistoryBytes(ctx)
222+
return internal.GetTotalEstimatedHistoryBytes(ctx)
223223
}
224224

225225
// GetHistoryCount returns the current number of history event of that workflow

0 commit comments

Comments
 (0)