From 5b53994447ceada1a1bb35ae0c93dcb5913ce98a Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 1 Aug 2019 20:18:14 -0400 Subject: [PATCH] feat: avoid calling the user-auth trigger where possible As this trigger is always in the execution path, `plugn` starts and expensively checks to see if it can execute the trigger. Rather than call this on every invocation, skip the trigger if no non-core implementation exists. --- plugins/common/functions | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/common/functions b/plugins/common/functions index ab317ca51..b38e88130 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -672,6 +672,12 @@ dokku_auth() { declare desc="calls user-auth plugin trigger" export SSH_USER=${SSH_USER:=$USER} export SSH_NAME=${NAME:="default"} + + # this plugin trigger exists in the core `20_events` plugin + if [[ $(find "$PLUGIN_PATH"/enabled/*/user-auth 2>/dev/null | wc -l) == 1 ]]; then + return 0 + fi + if ! plugn trigger user-auth "$SSH_USER" "$SSH_NAME" "$@"; then return 1 fi