# HG changeset patch # User Sebastien Jodogne # Date 1468499669 -7200 # Node ID f8d4543e3fef9e63988146788aa9805c92515a7d # Parent 27fd34970c5289224428fd3883b2312c4fb5d97a Asynchronous flags to avoid waiting for the completion of image transfers diff -r 27fd34970c52 -r f8d4543e3fef NEWS --- 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) diff -r 27fd34970c52 -r f8d4543e3fef OrthancServer/OrthancRestApi/OrthancRestModalities.cpp --- 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