Skip to content

Commit

Permalink
MB-28734 : make cancelTimer() return true on success, false if timer
Browse files Browse the repository at this point in the history
is not found and exception otherwise.

Change-Id: I7c4b59f9238c9903a91ebdedfc46a7748f952a55
Reviewed-on: http://review.couchbase.org/c/eventing/+/127363
Reviewed-by: CI Bot
Reviewed-by: <ankit.prabhu@couchbase.com>
Reviewed-by: Jeelan Basha Poola <jeelan.poola@couchbase.com>
Tested-by: Jeelan Basha Poola <jeelan.poola@couchbase.com>
  • Loading branch information
jeelanp2003 committed May 7, 2020
1 parent 402aa2e commit 1bc7cbd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions v8_consumer/src/timer.cc
Expand Up @@ -121,11 +121,16 @@ bool Timer::CancelTimerImpl(const v8::FunctionCallbackInfo<v8::Value> &args) {
FillTimerPartition(timer_info);

auto err = v8worker->DelTimer(timer_info);
if (err != LCB_SUCCESS) {

if (err == LCB_SUCCESS) {
args.GetReturnValue().Set(true);
} else if (err == LCB_KEY_ENOENT) {
args.GetReturnValue().Set(false);
} else {
js_exception->ThrowKVError(v8worker->GetTimerLcbHandle(), err);
return false;
}
args.GetReturnValue().Set(v8Str(isolate_, timer_info.reference));

return true;
}

Expand Down

0 comments on commit 1bc7cbd

Please sign in to comment.