Skip to content

Conversation

tubignat
Copy link
Contributor

What changed?
Timer task queue now keeps incoming tasks in an in-memory queue until the next execution iteration

Why?
To reduce load on DB by avoiding agressively polling it for next timer tasks

How did you test it?
[WIP]

Potential risks
[WIP]

DefaultValue: false,
},
TimerProcessorInMemoryQueue: {
KeyName: "history.timerProcessorInMemoryQueue",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to rename it history.enableTimerProcessorInMemoryQueue to make it a boolean explicitly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're using pending task tracker to track all the pending tasks in-memory and uses this component to get the ack level of history queues. The in-memory tasks introduced in this PR are NOT tracked by that component, so it's possible that the ack level becomes larger than a pending task.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And RemoveScheduledTasksAfter should be implemented in a way that invokes Cancel method of task interface on tasks in pending task tracker.

}
}

func (r *reschedulerImpl) RemoveScheduledTasksAfter(t time.Time) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is not necessary. Task has Cancel method. If it's canceled, it will be ignored by rescheduler.

ts := info.Tasks[i].GetVisibilityTimestamp()
if ts.Before(nextTime) {
nextTime = ts
readLevel := q.base.newVirtualSliceState.Range.InclusiveMinTaskKey.GetScheduledTime()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the current max read level. The current read level is in virtual slice component. If virtual queue is still trying to read tasks from the database, the task can be submitted twice.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes don't seem to be necessary.

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.

2 participants