Mercurial > hg > orthanc
comparison OrthancServer/LuaScripting.cpp @ 2637:5094369664f0
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:54:59 +0200 |
parents | 2e6b7862ccf2 |
children | 193ef9c1b731 |
comparison
equal
deleted
inserted
replaced
2634:442e7ef5cc41 | 2637:5094369664f0 |
---|---|
466 | 466 |
467 default: | 467 default: |
468 throw OrthancException(ErrorCode_InternalError); | 468 throw OrthancException(ErrorCode_InternalError); |
469 } | 469 } |
470 | 470 |
471 | 471 { |
472 // Avoid unnecessary calls to the database if there's no Lua callback | |
473 boost::recursive_mutex::scoped_lock lock(mutex_); | |
474 if (!lua_.IsExistingFunction(name)) | |
475 { | |
476 return; | |
477 } | |
478 } | |
479 | |
472 Json::Value tags, metadata; | 480 Json::Value tags, metadata; |
473 if (context_.GetIndex().LookupResource(tags, change.GetPublicId(), change.GetResourceType()) && | 481 if (context_.GetIndex().LookupResource(tags, change.GetPublicId(), change.GetResourceType()) && |
474 context_.GetIndex().GetMetadata(metadata, change.GetPublicId())) | 482 context_.GetIndex().GetMetadata(metadata, change.GetPublicId())) |
475 { | 483 { |
476 boost::recursive_mutex::scoped_lock lock(mutex_); | 484 boost::recursive_mutex::scoped_lock lock(mutex_); |