[CORE-1601] add hosting files upload#35
Conversation
… lib version - in setup; not released yet;
|
|
||
| :: | ||
|
|
||
| syncano hosting <instance_name> --list-files <domain> |
There was a problem hiding this comment.
I think that for now we should hide parameter as it doesn't make sense just yet
|
I would suggest that we simplify the flow for now. And instead when user does: As we won't have custom domain SSL support from the start, this should make it easier to use. We don't really care about list/create that much |
|
OK :) No problem, changes on the way. |
…ist hostings, and create hosting; add auto-create when publishing the static files (if no default hosting in instance is present);
| hosting.upload_file(path=file_path, file=upload_file) | ||
|
|
||
| uploaded_files.append(file_path) | ||
| time.sleep(1) # avoid throttling; |
There was a problem hiding this comment.
Not sure if sleep is needed here but if we're dealing with 1 API request (and sleep after each one) then sleep(0.02) is enough (as it still gives us less than 60/s at best). Once we support retry-after in python lib, we can remove it altogether.
There was a problem hiding this comment.
All this throttling thing is a little bit tricky - because client have no information about other requests (made by others clients) - so your idea to implement retry-after is the best way to handle it (servers knows how many requests should be handled - from all clients).
Will change to 0.02 here.
There was a problem hiding this comment.
Yeah, sleep in client code is still prone to errors as like you said - there can be other requests going on. Retry-after can actually be a good remedy for that.
|
lgtm! 👍 |
CI will always failt till the next Python Library release - 5.3, which will support hosting.