Skip to content

Commit

Permalink
Make scheduler be called in 10 seconds interval if no tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
psprint committed Nov 3, 2022
1 parent 9987d5c commit 6eba10b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions zinit.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -2390,10 +2390,13 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
# (delay), i.e. "burst" allows to run package installations from
# script, not from prompt.
@zinit-scheduler() {
integer ___ret="${${ZINIT[lro-data]%:*}##*:}"
integer ___ret="${${ZINIT[lro-data]%:*}##*:}" \
___secsR=$(($#ZINIT_TASKS>1?1:10))
# lro stands for lastarg-retval-option.
[[ $1 = following ]] && sched +1 'ZINIT[lro-data]="$_:$?:${options[printexitvalue]}"; @zinit-scheduler following "${ZINIT[lro-data]%:*:*}"'
[[ -n $1 && $1 != (following*|burst) ]] && { local THEFD="$1"; zle -F "$THEFD"; exec {THEFD}<&-; }
[[ $1 = following ]] && \
sched +$___secs 'ZINIT[lro-data]="$_:$?:${options[printexitvalue]}"; @zinit-scheduler following "${ZINIT[lro-data]%:*:*}"'
[[ -n $1 && $1 != (following*|burst) ]] && \
{ local THEFD="$1"; zle -F "$THEFD"; exec {THEFD}<&-; }
[[ $1 = burst ]] && local -h EPOCHSECONDS=$(( EPOCHSECONDS+10000 ))
ZINIT[START_TIME]="${ZINIT[START_TIME]:-$EPOCHREALTIME}"

Expand Down

0 comments on commit 6eba10b

Please sign in to comment.