diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index f2c77b04e1..39e15ed2ba 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -17,3 +17,4 @@ Fixed issues: * #1418 - Performance - Faster startup when there are GeoProperties in DB * #1478 - Fixed issue * #1479 - Fixed problem with "operations" in registrations + * #280 - Fixed a bug in the lookup of pernot subscriptions diff --git a/src/lib/orionld/pernot/pernotSubCacheLookup.cpp b/src/lib/orionld/pernot/pernotSubCacheLookup.cpp index abe0f67ca8..d0d3c4e4da 100644 --- a/src/lib/orionld/pernot/pernotSubCacheLookup.cpp +++ b/src/lib/orionld/pernot/pernotSubCacheLookup.cpp @@ -35,8 +35,8 @@ // PernotSubscription* pernotSubCacheLookup ( - const char* subscriptionId, - const char* tenant + const char* tenant, + const char* subscriptionId ) { for (PernotSubscription* pSubP = pernotSubCache.head; pSubP != NULL; pSubP = pSubP->next) diff --git a/src/lib/orionld/pernot/pernotSubCacheLookup.h b/src/lib/orionld/pernot/pernotSubCacheLookup.h index b4d7620e30..ad0f89917e 100644 --- a/src/lib/orionld/pernot/pernotSubCacheLookup.h +++ b/src/lib/orionld/pernot/pernotSubCacheLookup.h @@ -35,8 +35,8 @@ // extern PernotSubscription* pernotSubCacheLookup ( - const char* subscriptionId, - const char* tenant + const char* tenant, + const char* subscriptionId ); #endif // SRC_LIB_ORIONLD_PERNOT_PERNOTSUBCACHELOOKUP_H_ diff --git a/src/lib/orionld/serviceRoutines/orionldGetSubscription.cpp b/src/lib/orionld/serviceRoutines/orionldGetSubscription.cpp index 73e7448bf5..67dd70e3f8 100644 --- a/src/lib/orionld/serviceRoutines/orionldGetSubscription.cpp +++ b/src/lib/orionld/serviceRoutines/orionldGetSubscription.cpp @@ -217,7 +217,7 @@ static bool orionldGetSubscriptionFromDb(void) } else { - PernotSubscription* pSubP = pernotSubCacheLookup(orionldState.wildcard[0], orionldState.tenantP->tenant); + PernotSubscription* pSubP = pernotSubCacheLookup(orionldState.tenantP->tenant, orionldState.wildcard[0]); if (pSubP != NULL) orionldSubCounters(apiSubP, NULL, pSubP); } @@ -265,7 +265,7 @@ bool orionldGetSubscription(void) } // pernot subscription? - PernotSubscription* pSubP = pernotSubCacheLookup(subscriptionId, orionldState.tenantP->tenant); + PernotSubscription* pSubP = pernotSubCacheLookup(orionldState.tenantP->tenant, subscriptionId); if (pSubP != NULL) { orionldState.httpStatusCode = 200; diff --git a/test/functionalTest/cases/0000_ngsild/ngsild_get_pernot_and_normal_subscriptions.test b/test/functionalTest/cases/0000_ngsild/ngsild_get_pernot_and_normal_subscriptions.test index bba13cf0d0..274512f3c1 100644 --- a/test/functionalTest/cases/0000_ngsild/ngsild_get_pernot_and_normal_subscriptions.test +++ b/test/functionalTest/cases/0000_ngsild/ngsild_get_pernot_and_normal_subscriptions.test @@ -192,7 +192,7 @@ Link: ; rel="h 04. GET subs (from DB) ====================== HTTP/1.1 200 OK -Content-Length: 768 +Content-Length: 840 Content-Type: application/json Date: REGEX(.*) Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json" @@ -217,7 +217,10 @@ Link: ; rel="h "uri": "http://127.0.0.1:9997/notify" }, "format": "normalized", - "status": "ok" + "lastNotification": "202REGEX(.*)Z", + "noMatch": 1, + "status": "ok", + "timesSent": 1 }, "origin": "database", "q": "P3==1|P3==2",