Hey
I am currently experiencing an issue when querying a DB through a Macro with a Rest Call, the default timeout is set to 1000ms and I am intermittently getting the following error in the event log:
Error while evaluating expression: HTMLEncode(ResolveMacros(ResolveMacros(GetResourceString("Test"))))
I have tried adding |(timeout)3000 but it does not seem to work as expected.
Am I able to increase the default timeout value through the CMS code itself or perhaps I am implementing the |(timeout) incorrectly in the macro?
Macro - {%_mailerDomain = GlobalObjects.CustomTables["customtable"].Items.OrderBy("ItemID DESC").Where("GetDate() >= PublishDate" + " AND " + "[Key] = 'Domain'")[0]["ContentEN"]|(timeout)5000; %}
Thanks in advance
Regards, Domininc
Why are you ordering this query? I'd remove the order by clause and try again.
Secondly, I'd try your query in the Macro console.
Lastly, try to debug the query using Kenticos debugging tools.
It appears you're using the timeout correctly.
Hi Dominic,
Brenden is right - timeout is not your problem, the problem is that your query doesn't seem to be optimal. Try adding .TopN(1) parameter which should limit the number of retrieved items.
GlobalObjects.CustomTables["customtable"].Items.OrderBy("ItemID DESC").Where("GetDate() >= PublishDate" + " AND " + "[Key] = 'Domain'").TopN(1)[0]["ContentEN"]
And of course try System > Macro > Debug or Benchmark applications to optimize your macro.
Please, sign in to be able to submit a new answer.