Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit 0f4abc49 authored by Christophe Chaudier's avatar Christophe Chaudier :rocket:
Browse files

Merge branch '17-api-rates-limites' into 'master'

Resolve "API rates limites"

Closes #17

See merge request !11
parents 452b4080 5eac9079
No related branches found
No related tags found
1 merge request!11Resolve "API rates limites"
Pipeline #2065 passed with warnings
...@@ -31,7 +31,9 @@ Options : ...@@ -31,7 +31,9 @@ Options :
-g path/to/group : export the group and is subgroups and projects -g path/to/group : export the group and is subgroups and projects
-a : export all my group and subgroup -a : export all my group and subgroup
' '
readonly WAITING_TIME=5 # https://docs.gitlab.com/ee/user/group/settings/import_export.html#rate-limits
readonly DELAY_EXPORT=10
readonly DELAY_EXPORT_DL=60
# -- Vars # -- Vars
config_file='.mygb_config' config_file='.mygb_config'
...@@ -124,6 +126,7 @@ _get_project_info() { ...@@ -124,6 +126,7 @@ _get_project_info() {
# ---[ Export Project ]--- # ---[ Export Project ]---
_schedule_project_export() { _schedule_project_export() {
sleep ${DELAY_EXPORT}
_api POST "projects/${project_url_encoded}/export" | jq | grep --silent "202 Accepted" \ _api POST "projects/${project_url_encoded}/export" | jq | grep --silent "202 Accepted" \
|| _fail "Can't schedule export for project [${project}]" || _fail "Can't schedule export for project [${project}]"
} }
...@@ -135,7 +138,7 @@ _project_export_status() { ...@@ -135,7 +138,7 @@ _project_export_status() {
_wait_export_finished() { _wait_export_finished() {
while [[ "$(_project_export_status)" != "finished" ]]; do while [[ "$(_project_export_status)" != "finished" ]]; do
echo "Waiting end of export ..." echo "Waiting end of export ..."
sleep ${WAITING_TIME} sleep ${DELAY_EXPORT_DL}
done done
} }
...@@ -158,6 +161,7 @@ _export_project() { ...@@ -158,6 +161,7 @@ _export_project() {
# ---[ Export Group ]--- # ---[ Export Group ]---
_schedule_group_export() { _schedule_group_export() {
sleep ${DELAY_EXPORT}
_api POST "groups/${group_url_encoded}/export" | jq | grep --silent "202 Accepted" \ _api POST "groups/${group_url_encoded}/export" | jq | grep --silent "202 Accepted" \
|| _fail "Can't schedule export for group [${group}]" || _fail "Can't schedule export for group [${group}]"
} }
...@@ -170,9 +174,9 @@ _group_export_status() { ...@@ -170,9 +174,9 @@ _group_export_status() {
_wait_group_finished() { _wait_group_finished() {
while [[ "$(_group_export_status)" != "finished" ]]; do while [[ "$(_group_export_status)" != "finished" ]]; do
echo "Waiting end of export ..." echo "Waiting end of export ..."
sleep ${WAITING_TIME} sleep ${DELAY_EXPORT_DL}
done done
sleep 60 sleep ${DELAY_EXPORT_DL}
} }
_download_group_export() { _download_group_export() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment