[CP] [bugfix] fix the bug that the task be scheduled after being canceled
This commit is contained in:
7
deps/oblib/src/lib/task/ob_timer.cpp
vendored
7
deps/oblib/src/lib/task/ob_timer.cpp
vendored
@ -445,6 +445,13 @@ void ObTimer::run1()
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL == running_task_)
|
||||
{
|
||||
// If running_task_ is NULL, the token is not associated with any task,
|
||||
// so we reset it to avoid the task being scheduled unexpectedly.
|
||||
token.reset();
|
||||
}
|
||||
|
||||
if (token.task != NULL && running_task_ != NULL && !is_destroyed_ && !is_stopped_) {
|
||||
bool timeout_check = token.task->timeout_check();
|
||||
const int64_t start_time = ::oceanbase::common::ObTimeUtility::current_time();
|
||||
|
||||
6
deps/oblib/src/lib/task/ob_timer.h
vendored
6
deps/oblib/src/lib/task/ob_timer.h
vendored
@ -97,6 +97,12 @@ private:
|
||||
Token(): scheduled_time(0), delay(0), task(NULL) {}
|
||||
Token(const int64_t st, const int64_t dt, ObTimerTask *task)
|
||||
: scheduled_time(st), delay(dt), task(task) {}
|
||||
void reset()
|
||||
{
|
||||
scheduled_time = 0;
|
||||
delay = 0;
|
||||
task = NULL;
|
||||
}
|
||||
TO_STRING_KV(K(scheduled_time), K(delay), KP(task), KPC(task));
|
||||
int64_t scheduled_time;
|
||||
int64_t delay;
|
||||
|
||||
Reference in New Issue
Block a user