1
0
Fork 0

added some useful comment

This commit is contained in:
Sandro La Bruzzo 2024-01-10 19:51:13 +01:00
parent 39ebb60b38
commit 859babf722
1 changed files with 6 additions and 0 deletions

View File

@ -135,6 +135,8 @@ public class ORCIDWorker extends Thread {
total_time = System.currentTimeMillis() - start; total_time = System.currentTimeMillis() - start;
requests++; requests++;
if (total_time < 1000) { 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); Thread.sleep(1000L - total_time);
} }
start = System.currentTimeMillis(); start = System.currentTimeMillis();
@ -142,6 +144,8 @@ public class ORCIDWorker extends Thread {
total_time = System.currentTimeMillis() - start; total_time = System.currentTimeMillis() - start;
requests++; requests++;
if (total_time < 1000) { 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); Thread.sleep(1000L - total_time);
} }
start = System.currentTimeMillis(); start = System.currentTimeMillis();
@ -149,6 +153,8 @@ public class ORCIDWorker extends Thread {
total_time = System.currentTimeMillis() - start; total_time = System.currentTimeMillis() - start;
requests++; requests++;
if (total_time < 1000) { 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); Thread.sleep(1000L - total_time);
} }
if (requests %30 ==0) if (requests %30 ==0)