Skip to content
This repository was archived by the owner on Oct 30, 2018. It is now read-only.

[LIB-820] add time.sleep in some places to avoid throttling when migrating the data;#36

Merged
opalczynski merged 3 commits intodevelopfrom
LIB-820
Jul 26, 2016
Merged

[LIB-820] add time.sleep in some places to avoid throttling when migrating the data;#36
opalczynski merged 3 commits intodevelopfrom
LIB-820

Conversation

@opalczynski
Copy link
Copy Markdown
Contributor

No description provided.

objects_to_add.append(batched_syncano_object)
parse_ids.append(data_object['objectId'])

time.sleep(6) # avoid throttling;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6? Why when we have only rate limit per second?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, because the batch make 10 creates/updates 60/10 = 6 - or am I bad at math? :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we only have limits per second. So every second it's a fresh limit. So time.sleep(1) should always "refresh" it. And this way it will be only possible to run into rate limit when we use more than 60 calls before sleeping

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, get it :)

@23doors
Copy link
Copy Markdown
Member

23doors commented Jul 26, 2016

Maybe we could add some support for Retry-After in library instead? When we send a request we could check if code == 429, get header value for Retry-After, parse it as float and sleep for the time it specifies and then retry. This way even if we change to some burst throttles (per minute window), it'll still work. And less obnoxious errors for users ;)

@opalczynski
Copy link
Copy Markdown
Contributor Author

@23doors it's nice! I will create a task for that and handle it in next or next next sprint.

@opalczynski
Copy link
Copy Markdown
Contributor Author

@23doors I will merge that for now and in few weeks when add retry to python LIB - will change the logic here. Is this ok?

@23doors
Copy link
Copy Markdown
Member

23doors commented Jul 26, 2016

Sure! fine with me :)

@opalczynski opalczynski merged commit 0b3f657 into develop Jul 26, 2016
@opalczynski opalczynski deleted the LIB-820 branch July 26, 2016 14:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants