0

Is there a way (and if so, what is the simplest one) to delay (or sleep for n seconds) the execution of the batch request below, for each x?

Say for example I have the following:

my_batch=my_service.new_batch_http_request()

for x in Y:
            my_batch.add(
                my_service.insert( )
            )
my_batch.execute()

Or even more to the point: for each x in Y, wait n seconds before execution on the server side (where my google service resides). Say for example, my service is google drive, or calendar, or anything else where google new_batch_http_request works.

  • https://stackoverflow.com/a/510351/12511801 – Marco Aurelio Fernandez Reyes Mar 08 '22 at 20:06
  • Thanks Marco. But I don't think that's the answer to my question?...you are just telling me to insert a sleep inside the add loop(?)...which does not solve my problem... Simply because , regardless of the delay inside the loop, the request is executed all at once, i.e., all x in Y will be nonetheless requested all at once...and executed on the server in some way that is totally useless without the delay ...and the request will return an error of type 500...so, as stated in my original question: what I need to know is how to delay the execution on the Google service side, – RhombicTriacontahedron Mar 08 '22 at 20:30
  • Then, consider check the documentation and post an issue/bug there - see links of interest: [link1](https://github.com/googleapis/google-api-python-client/issues) - [link 2](https://googleapis.github.io/google-api-python-client/) - [link 3](https://googleapis.github.io/google-api-python-client/docs/batch.html). Good luck. – Marco Aurelio Fernandez Reyes Mar 09 '22 at 13:55

0 Answers0