From cae79d1c177afc85d28eaab53defb5f8269a29db Mon Sep 17 00:00:00 2001 From: Anton Boritskiy Date: Thu, 10 Jun 2021 03:09:32 +0200 Subject: [PATCH] ADHOC feat async-import: control async timeouts there are project where reindex takes way longer than 10 minutes, those projects should have a possibility to specify a higher timeout. --- defaults/main.yml | 8 +++++++- tasks/cleanup-old-clones.yml | 4 ++-- tasks/installation.yml | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 0df719a..71065c2 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -332,7 +332,13 @@ magento_force_reindex_on_deploy: False # when clones are cleaned up asynchronously, role is not checking successful execution magento_allow_async_cleanup_old_clones: false +# timeout for async old clones cleanup, seconds +magento_async_cleanup_old_clones_timeout: 600 + # allows to run magento reindexing asynchronously, # this allows pipeline to finish faster due to "parallel" execution of tasks # when reindexing is done asynchronously, role is not checking successful execution -magento_allow_async_reindex: false \ No newline at end of file +magento_allow_async_reindex: false + +# timeout for async reindex execution, seconds +magento_async_reindex_timeout: 600 diff --git a/tasks/cleanup-old-clones.yml b/tasks/cleanup-old-clones.yml index 822a785..6d4886e 100644 --- a/tasks/cleanup-old-clones.yml +++ b/tasks/cleanup-old-clones.yml @@ -13,7 +13,7 @@ state: absent when: magento_cleanup_old_clones and magento_allow_async_cleanup_old_clones with_items: "{{ (magento_clones_for_cleanup.files | sort(attribute='ctime', reverse=True))[magento_clones_to_keep:] | list }}" - async: 600 + async: "{{ magento_async_cleanup_old_clones_timeout }}" poll: 0 - name: "Remove old clones/releases synchronously" @@ -21,4 +21,4 @@ path: "{{ item.path }}" state: absent when: magento_cleanup_old_clones and (not magento_allow_async_cleanup_old_clones) - with_items: "{{ (magento_clones_for_cleanup.files | sort(attribute='ctime', reverse=True))[magento_clones_to_keep:] | list }}" \ No newline at end of file + with_items: "{{ (magento_clones_for_cleanup.files | sort(attribute='ctime', reverse=True))[magento_clones_to_keep:] | list }}" diff --git a/tasks/installation.yml b/tasks/installation.yml index 991b2cb..a0266b6 100644 --- a/tasks/installation.yml +++ b/tasks/installation.yml @@ -221,7 +221,7 @@ become_user: "{{ magento_user }}" command: "/usr/bin/php {{ magento_app_root }}/bin/magento indexer:reindex" when: (magento_db_status.stdout_lines|length == 0 or magento_force_reindex_on_deploy == True) and magento_allow_async_reindex - async: 600 + async: "{{ magento_async_reindex_timeout }}" poll: 0 - name: "Let Magento indexer run synchronously"