apache / openwhisk-package-alarms

Apache OpenWhisk package that can be used to create periodic, time-based alarms.
https://openwhisk.apache.org/
Apache License 2.0
24 stars 49 forks source link

Added support for Azure cosmosDB for alarms package #163

Open sandeep-paliwal opened 6 years ago

sandeep-paliwal commented 6 years ago

Added support for alarms package to use cosmos DB. All database interactions will now go through database.js which in turn will delegate to actual DB implementations (couchdb or cosmosdb) based on dbType. There are some TODO comments and need to get better understanding on those.

jasonpet commented 6 years ago

@sandeep-paliwal - have you tested this with couchdb? fails for me

"namespace": "whisk.system",
    "name": "alarmWebAction",
    "version": "0.0.2",
    "subject": "whisk.system",
    "activationId": "5d9dfa5f98cb4f629dfa5f98cb2f6232",
    "start": 1539971896476,
    "end": 1539971896495,
    "duration": 19,
    "response": {
        "status": "application error",
        "statusCode": 0,
        "success": false,
        "result": {
            "error": {
                "message": "Cannot read property 'getWorkerID' of undefined",
                "stack": "TypeError: Cannot read property 'getWorkerID' of undefined\n    at common.verifyTriggerAuth.then (/nodejsAction/dUGHWGoL/alarmWebAction.js:135:26)\n    at process._tickCallback (internal/process/next_tick.js:109:7)"
jasonpet commented 6 years ago

@sandeep-paliwal Please run all tests to verify it works once you fix this issue. The getDatabase function in alarmWebAction needs to be a promise that you wait on when you call it. You are returning the database but only after you wait on the initDB. The call to getDatabase right before you try to getWorkerID is undefined because you are not waiting on it.

jasonpet commented 6 years ago

@sandeep-paliwal I also see some alarms functionality that exists with couchdb that was not made available with cosmosDB as part of this PR:

sandeep-paliwal commented 6 years ago

Thanks for the comments @jasonpet . I will update the PR and run the tests you have mentioned.