Skip to content

Commit 69498f6

Browse files
authored
Merge pull request #389 from jamessan/concurrency-limit
Defer VCS detection when too many jobs are running
2 parents 54fac3a + 701d22f commit 69498f6

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

autoload/sy.vim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ function! sy#start(...) abort
1010
return
1111
endif
1212

13+
if g:signify_detecting > 50
14+
call sy#verbose('Too many detection jobs running, deferring detection')
15+
return
16+
endif
17+
1318
let bufnr = a:0 && has_key(a:1, 'bufnr') ? a:1.bufnr : bufnr('')
1419
let sy = getbufvar(bufnr, 'sy')
1520

autoload/sy/repo.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ function! sy#repo#detect(bufnr) abort
77
let sy = getbufvar(a:bufnr, 'sy')
88
for vcs in s:vcs_list
99
let sy.detecting += 1
10+
let g:signify_detecting += 1
1011
call sy#repo#get_diff(a:bufnr, vcs, function('sy#sign#set_signs'))
1112
endfor
1213
endfunction
@@ -130,6 +131,7 @@ function! s:handle_diff(options, exitval) abort
130131
call sy#verbose(printf('Signs already got updated by %s.', sy.updated_by), a:options.vcs)
131132
return
132133
elseif empty(sy.vcs)
134+
let g:signify_detecting -= 1
133135
let sy.detecting -= 1
134136
endif
135137

plugin/signify.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ endif
88

99
let g:loaded_signify = 1
1010
let g:signify_locked = 0
11+
let g:signify_detecting = 0
1112

1213
" Commands {{{1
1314
command! -nargs=0 -bar SignifyList call sy#debug#list_active_buffers()

0 commit comments

Comments
 (0)