From 859babf7223990d0f5146fb6dc45dd73a251127a Mon Sep 17 00:00:00 2001 From: "sandro.labruzzo" Date: Wed, 10 Jan 2024 19:51:13 +0100 Subject: [PATCH] added some useful comment --- .../java/eu/dnetlib/dhp/collection/orcid/ORCIDWorker.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/collection/orcid/ORCIDWorker.java b/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/collection/orcid/ORCIDWorker.java index 9560c36a2..0abebd8b8 100644 --- a/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/collection/orcid/ORCIDWorker.java +++ b/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/collection/orcid/ORCIDWorker.java @@ -135,6 +135,8 @@ public class ORCIDWorker extends Thread { total_time = System.currentTimeMillis() - start; requests++; if (total_time < 1000) { + //I know making a sleep on a thread is bad, but we need to stay to 24 requests per seconds, hence + //the time between two http request in a thread must be 1 second Thread.sleep(1000L - total_time); } start = System.currentTimeMillis(); @@ -142,6 +144,8 @@ public class ORCIDWorker extends Thread { total_time = System.currentTimeMillis() - start; requests++; if (total_time < 1000) { + //I know making a sleep on a thread is bad, but we need to stay to 24 requests per seconds, hence + //the time between two http request in a thread must be 1 second Thread.sleep(1000L - total_time); } start = System.currentTimeMillis(); @@ -149,6 +153,8 @@ public class ORCIDWorker extends Thread { total_time = System.currentTimeMillis() - start; requests++; if (total_time < 1000) { + //I know making a sleep on a thread is bad, but we need to stay to 24 requests per seconds, hence + //the time between two http request in a thread must be 1 second Thread.sleep(1000L - total_time); } if (requests %30 ==0)