-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Over-requesting to CPrs attributes that has been filtered out with attrs= #3745
Comments
It also happens if the GET is done in a specific entity (eg. CAM3). I mean:
Results in:
|
(Maybe we already have this problem described in another issue, but I haven't found it so far) |
Having a look to code in getEntity.cpp:
Note that the It seems that in the past we considered pushing down it, but it seems has some problem:
|
Situation is pretty much the same for getEntities.cpp |
I have done this little hack: diff --git a/src/lib/serviceRoutinesV2/getEntities.cpp b/src/lib/serviceRoutinesV2/getEntities.cpp
index cbc82502e..afcc483da 100644
--- a/src/lib/serviceRoutinesV2/getEntities.cpp
+++ b/src/lib/serviceRoutinesV2/getEntities.cpp
@@ -303,10 +303,11 @@ std::string getEntities
}
// Get attrs and metadata filters from URL params
- // Note we cannot set the attrs filter on &parseDataP->qcr.res.attrsFilterList given that parameter is used for querying on DB
+ // Note we cannot set the attrs filter on &parseDataP->qcr.res.attrsList given that parameter is used for querying on DB
// and some .test would break. We use a fresh variable (attributeFilter) for that
- StringList attributeFilter;
- setAttrsFilter(ciP->uriParam, ciP->uriParamOptions, &attributeFilter);
+ //StringList attributeFilter;
+ //setAttrsFilter(ciP->uriParam, ciP->uriParamOptions, &attributeFilter);
+ setAttrsFilter(ciP->uriParam, ciP->uriParamOptions, &parseDataP->qcr.res.attrsList);
setMetadataFilter(ciP->uriParam, &parseDataP->qcr.res.metadataList);
// 02. Call standard op postQueryContext
@@ -332,7 +333,8 @@ std::string getEntities
else
{
TIMED_RENDER(answer = entities.toJson(getRenderFormat(ciP->uriParamOptions),
- attributeFilter.stringV,
+ parseDataP->qcr.res.attrsList.stringV,
+ //attributeFilter.stringV,
false,
parseDataP->qcr.res.metadataList.stringV));
ciP->httpStatusCode = SccOk;
diff --git a/src/lib/serviceRoutinesV2/getEntity.cpp b/src/lib/serviceRoutinesV2/getEntity.cpp
index 044d6d5e7..3c70f7c87 100644
--- a/src/lib/serviceRoutinesV2/getEntity.cpp
+++ b/src/lib/serviceRoutinesV2/getEntity.cpp
@@ -87,10 +87,11 @@ std::string getEntity
parseDataP->qcr.res.fill(entityId, type, "false", EntityTypeEmptyOrNotEmpty, "");
// Get attrs and metadata filters from URL params
- // Note we cannot set the attrs filter on &parseDataP->qcr.res.attrsFilterList given that parameter is used for querying on DB
+ // Note we cannot set the attrs filter on &parseDataP->qcr.res.attrsList given that parameter is used for querying on DB
// and some .test would break. We use a fresh variable (attributeFilter) for that
- StringList attributeFilter;
- setAttrsFilter(ciP->uriParam, ciP->uriParamOptions, &attributeFilter);
+ //StringList attributeFilter;
+ //setAttrsFilter(ciP->uriParam, ciP->uriParamOptions, &attributeFilter);
+ setAttrsFilter(ciP->uriParam, ciP->uriParamOptions, &parseDataP->qcr.res.attrsList);
setMetadataFilter(ciP->uriParam, &parseDataP->qcr.res.metadataList);
// Call standard op postQueryContext
@@ -113,7 +114,8 @@ std::string getEntity
if (oe.code == SccNone)
{
TIMED_RENDER(answer = entity.toJson(getRenderFormat(ciP->uriParamOptions),
- attributeFilter.stringV,
+ parseDataP->qcr.res.attrsList.stringV,
+ //attributeFilter.stringV,
false,
parseDataP->qcr.res.metadataList.stringV));
} And now it works without forwarding requests:
Let's do a full pass in functional tests with the hacked code to see which ones break... |
Only one test is failing:
|
That test has the following script:
The fail is in step 11 that instead of returning E1 with A1 and E2+E3 without attrs only returns E1 (A1). However, I think this is the right behavior... Maybe the test is wrong? |
PR #3751 |
Situation: there are four entities (CAM1, CAM2, CAM3, CAM4) with a registered attribute
makeSnapshot
,setPTZ
andsetSnapshotsCrontab
(depending on the entity one of them, two or the three).We do a query that is filtering out the
makeSnapshot
, etc. registred attributes using attrs= query paramRegardless the filter, the
makeSnapshot
is queried to the CPr but it shouldn't. It can introduce an undesired response delay due to timeout if the CPr is not online, as shown in the trace below:The text was updated successfully, but these errors were encountered: