Mercurial > hg > orthanc
comparison OrthancServer/LuaScripting.cpp @ 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 | 1232922c8793 |
children | c691fcf66071 |
comparison
equal
deleted
inserted
replaced
2636:c72eb844758c | 2638:25ae209dcea9 |
---|---|
152 | 152 |
153 default: | 153 default: |
154 throw OrthancException(ErrorCode_InternalError); | 154 throw OrthancException(ErrorCode_InternalError); |
155 } | 155 } |
156 | 156 |
157 { | |
158 // Avoid unnecessary calls to the database if there's no Lua callback | |
159 LuaScripting::Lock lock(that); | |
160 | |
161 if (!lock.GetLua().IsExistingFunction(name)) | |
162 { | |
163 return; | |
164 } | |
165 } | |
166 | |
157 Json::Value tags, metadata; | 167 Json::Value tags, metadata; |
158 if (that.context_.GetIndex().LookupResource(tags, change_.GetPublicId(), change_.GetResourceType()) && | 168 if (that.context_.GetIndex().LookupResource(tags, change_.GetPublicId(), change_.GetResourceType()) && |
159 that.context_.GetIndex().GetMetadata(metadata, change_.GetPublicId())) | 169 that.context_.GetIndex().GetMetadata(metadata, change_.GetPublicId())) |
160 { | 170 { |
161 LuaScripting::Lock lock(that); | 171 LuaScripting::Lock lock(that); |