Browse Source

ready can be called with no views

Kieran Gibb 3 years ago
parent
commit
1cb3bfe43d
No account linked to committer's email address
1 changed files with 4 additions and 2 deletions
  1. 4
    2
      index.js

+ 4
- 2
index.js View File

@@ -58,12 +58,13 @@ Kappa.prototype.ready = function (viewNames, cb) {
58 58
     viewNames = Object.keys(this._indexes)
59 59
   }
60 60
 
61
-  var pending = viewNames.length
61
+  var pending = viewNames.length + 1
62 62
   var self = this
63 63
   this._logs.ready(function () {
64 64
     for (var i = 0; i < viewNames.length; i++) {
65 65
       self._indexes[viewNames[i]].ready(done)
66 66
     }
67
+    done()
67 68
   })
68 69
 
69 70
   function done () {
@@ -84,12 +85,13 @@ Kappa.prototype.pause = function (viewNames, cb) {
84 85
     viewNames = Object.keys(this._indexes)
85 86
   }
86 87
 
87
-  var pending = viewNames.length
88
+  var pending = viewNames.length + 1
88 89
   var self = this
89 90
   this._logs.ready(function () {
90 91
     for (var i = 0; i < viewNames.length; i++) {
91 92
       self._indexes[viewNames[i]].pause(done)
92 93
     }
94
+    done()
93 95
   })
94 96
 
95 97
   function done () {