Skip to content

Commit e81bd43

Browse files
committed
increase batcher max update count and allow it to be configured (close #950)
1 parent eabca4d commit e81bd43

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/batcher.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var _ = require('./util')
2-
var MAX_UPDATE_COUNT = 10
2+
var config = require('./config')
33

44
// we have two separate queues: one for directive updates
55
// and one for user watcher registered via $watch().
@@ -70,7 +70,7 @@ exports.push = function (job) {
7070
} else {
7171
has[id]++
7272
// detect possible infinite update loops
73-
if (has[id] > MAX_UPDATE_COUNT) {
73+
if (has[id] > config._maxUpdateCount) {
7474
_.warn(
7575
'You may have an infinite update loop for the ' +
7676
'watcher with expression: "' + job.expression + '".'
@@ -92,4 +92,4 @@ exports.push = function (job) {
9292
_.nextTick(flush)
9393
}
9494
}
95-
}
95+
}

src/config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,13 @@ module.exports = {
8585
ONE_WAY: 0,
8686
TWO_WAY: 1,
8787
ONE_TIME: 2
88-
}
88+
},
89+
90+
/**
91+
* Max circular updates allowed in a batcher flush cycle.
92+
*/
93+
94+
_maxUpdateCount: 100
8995

9096
}
9197

0 commit comments

Comments
 (0)