Hi, I’m testing the createTimer
function with a similar code:
function OnUpdate(doc, meta) {
log(doc, meta);
const now = new Date();
const executeAtDate = new Date(now.getTime() + 2000);
log('Creating timer', executeAtDate);
// Setup the timer
createTimer(onTimer, executeAtDate, meta.id, {id: meta.id});
}
function onTimer(context) {
log('Running timer', context.id);
const doc = bucket_source[context.id];
// Simple set
doc.processedSimple = true;
bucket_target[context.id] = doc;
log('Set document flags', context.id);
}
By inspecting the function logs (in the @eventing
dir), I can see that the first block gets invoked correctly on every document update, while the second block takes some times even more than 120 seconds to be invoked at least once.
I can see that the timer is planned:
2018-09-03T04:15:09.037+00:00 [INFO] {"docType":"eventing_integration_test_model","id":"DbModelEventingFunctionTestTimer_1535948053460","createdAt":1535948053460,"updatedAt":1535948053460,"counter":6,"processedSimple":false,"response":null} {"cas":1535948103505477600,"id":"wdm_eventing_integration_test_model_DbModelEventingFunctionTestTimer_1535948053460","expiration":0,"flags":33554432,"vb":622,"seq":7}
2018-09-03T04:15:09.037+00:00 [INFO] "Creating timer" "2018-09-03T04:15:11.036Z"
Timer than takes a long time to start:
2018-09-03T04:16:54.201+00:00 [INFO] "Running timer" "wdm_eventing_integration_test_model_DbModelEventingFunctionTestTimer_1535948053460"
2018-09-03T04:16:54.205+00:00 [INFO] "Set document flags" "wdm_eventing_integration_test_model_DbModelEventingFunctionTestTimer_1535948053460"
I’m running Couchbase 6.0.0-beta in Docker (Windows host), with:
-
Processor Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz, 2904 Mhz, 4 Core(s), 8 Logical Processor(s)
, 4 logical processors made available to Docker. - ~1GB of RAM associated to the eventing service.
I’m trying to figure out if my setup is too weak for the eventing service to operate, or if there’s any tuning I can perform on the function settings.
Do you have any clue what could be going on?
Thanks,
Alberto