Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
colineguerin
Contributor II
Contributor II

Put tRESTClient to sleep if error 429 with run if trigger

Hello,

I have a job that sends PUT requests through the tRESTClient component. Unfortunately, the API I send the data to has a limited number of requests per minute and, after, the first 1000 requests or so, I get an error 429 "Too Many Requests". 

The only thing I can do is put my job to sleep for a certain amount of time so that the API request limit can refresh and I can re-start my requests. 

So, I put a Run if trigger on my tRESTClient component, that connects to the tSleep component, so that it will trigger if error_message from tRESTClient is 429. Then, another Run if trigger, connected to a tSetGlobalVar that returns the error_message to null after it triggered.

It worked perfectly well 2 weeks ago and I haven't touched my job ever since, but today the run-ifs don't seem to trigger anymore and I don't understand why. I have tried with tJavaRow component as well, but the issue remains the same. 

Does anyone see any flaws in my logic? Or any other possible solution?

Any help would be much welcome, as I don't see why it suddenly doesn't work anymore...

Here's attached what my subjob looks like.

Labels (2)
5 Replies
Shicong_Hong
Support
Support

Hi

Can you share a screenshot of your job? and show us the expression you set up for runIf trigger.

Regards

Shicong

colineguerin
Contributor II
Contributor II
Author

Oops I thought I already had. Here's my subjob and the run if expression (second one is the same). The thing is, my run if does trigger, but only once all iterations are done. 

talend.png

colineguerin
Contributor II
Contributor II
Author

[EDIT]

I eventually removed the "Run If" triggers and changed the position of my tSleep component to put it after the tRESTClient's error output. It triggers thanks to a filter in tMap that catches only errorCode equal to 429.

So I have two outputs from my tMap component (extractPUTErrorMessages): one that saves all errors in a tFileOutputDelimited, and one that filters only 429 error codes and connects to tSleep.

It solves my issue and looks more elegant this way, but I still don't know why my "Run If" trigger stopped working in the first place.

Shicong_Hong
Support
Support

Maybe it is not 429 error each time or the value of global variable is null, so the condition of runIf is false and it will not be triggered. To test it, print the value of global variable ((String)globalMap.get("tRESTClient_3_ERROR_MESSAGE")) on a tJava on the console to see what it is.

colineguerin
Contributor II
Contributor II
Author

Yeah I did check the value of my global variable but even if it were null, the Run If would indicate "false", wouldn't it? The problem is, the run if only starts to check the condition once all iterations have passed and then indicates true or false, while I wanted it to check the condition after each iteration. 

I guess that is just how Run If links work 😕

Thanks for your reply anyway!