Mercurial > hg > orthanc
changeset 2072:f8d4543e3fef
Asynchronous flags to avoid waiting for the completion of image transfers
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 14 Jul 2016 14:34:29 +0200 |
parents | 27fd34970c52 |
children | 1d7a640c1dda |
files | NEWS OrthancServer/OrthancRestApi/OrthancRestModalities.cpp |
diffstat | 2 files changed, 22 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Thu Jul 14 14:21:29 2016 +0200 +++ b/NEWS Thu Jul 14 14:34:29 2016 +0200 @@ -1,8 +1,10 @@ Pending changes in the mainline =============================== +* New configuration options: "DicomScuTimeout" and "DicomScpTimeout" * "Permissive" flag for URI "/modalities/{...}/store" to ignore C-Store transfer errors -* New configuration options: "DicomScuTimeout" and "DicomScpTimeout" +* "Asynchronous" flag for URIs "/modalities/{...}/store" and "/peers/{...}/store" + to avoid waiting for the completion of image transfers Version 1.1.0 (2016/06/27)
--- a/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp Thu Jul 14 14:21:29 2016 +0200 +++ b/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp Thu Jul 14 14:34:29 2016 +0200 @@ -685,6 +685,7 @@ std::string localAet = Toolbox::GetJsonStringField(request, "LocalAet", context.GetDefaultLocalApplicationEntityTitle()); bool permissive = Toolbox::GetJsonBooleanField(request, "Permissive", false); + bool asynchronous = Toolbox::GetJsonBooleanField(request, "Asynchronous", false); int moveOriginatorID = Toolbox::GetJsonIntegerField(request, "MoveOriginatorID", 0 /* By default, not a C-MOVE */); if (moveOriginatorID < 0 || @@ -705,9 +706,15 @@ job.SetDescription("HTTP request: Store-SCU to peer \"" + remote + "\""); - if (context.GetScheduler().SubmitAndWait(job)) + if (asynchronous) { - // Success + // Asynchronous mode: Submit the job, but don't wait for its completion + context.GetScheduler().Submit(job); + call.GetOutput().AnswerBuffer("{}", "application/json"); + } + else if (context.GetScheduler().SubmitAndWait(job)) + { + // Synchronous mode: We have submitted and waited for completion call.GetOutput().AnswerBuffer("{}", "application/json"); } else @@ -812,6 +819,8 @@ return; } + bool asynchronous = Toolbox::GetJsonBooleanField(request, "Asynchronous", false); + WebServiceParameters peer; Configuration::GetOrthancPeer(peer, remote); @@ -824,9 +833,15 @@ job.SetDescription("HTTP request: POST to peer \"" + remote + "\""); - if (context.GetScheduler().SubmitAndWait(job)) + if (asynchronous) { - // Success + // Asynchronous mode: Submit the job, but don't wait for its completion + context.GetScheduler().Submit(job); + call.GetOutput().AnswerBuffer("{}", "application/json"); + } + else if (context.GetScheduler().SubmitAndWait(job)) + { + // Synchronous mode: We have submitted and waited for completion call.GetOutput().AnswerBuffer("{}", "application/json"); } else