Mercurial > hg > orthanc
changeset 2638:25ae209dcea9 jobs
Avoid unnecessary calls to the database if there is no Lua callback
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 28 May 2018 10:58:07 +0200 |
parents | c72eb844758c |
children | 75a404e40323 |
files | OrthancServer/LuaScripting.cpp |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/LuaScripting.cpp Mon May 28 10:52:18 2018 +0200 +++ b/OrthancServer/LuaScripting.cpp Mon May 28 10:58:07 2018 +0200 @@ -154,6 +154,16 @@ throw OrthancException(ErrorCode_InternalError); } + { + // Avoid unnecessary calls to the database if there's no Lua callback + LuaScripting::Lock lock(that); + + if (!lock.GetLua().IsExistingFunction(name)) + { + return; + } + } + Json::Value tags, metadata; if (that.context_.GetIndex().LookupResource(tags, change_.GetPublicId(), change_.GetResourceType()) && that.context_.GetIndex().GetMetadata(metadata, change_.GetPublicId()))