9

特定のリポジトリからすべての git の問題を照会することになっている、かなり単純な流星アプリを初めて作成しています。github api から問題のリストを取得した後、これらの問題からタスクのコレクションを作成するという考え方です。ただし、現在のタスクのリストを照会しようとすると、次のようになります。

.../.meteor/tools/c2a0453c51/lib/node_modules/fibers/future.js:83
W20140418-17:00:43.872(-7)? (STDERR)        throw new Error('Can\'t wait without a fiber');
W20140418-17:00:43.872(-7)? (STDERR)              ^
W20140418-17:00:43.889(-7)? (STDERR) Error: Can't wait without a fiber
W20140418-17:00:43.889(-7)? (STDERR)     at Function.wait    
(.../.meteor/tools/c2a0453c51/lib/node_modules/fibers/future.js:83:9)
W20140418-17:00:43.890(-7)? (STDERR)     at Object.Future.wait    
(.../.meteor/tools/c2a0453c51/lib/node_modules/fibers/future.js:325:10)
W20140418-17:00:43.890(-7)? (STDERR)     at _.extend._nextObject (packages/mongo-    
livedata/mongo_driver.js:805)
W20140418-17:00:43.890(-7)? (STDERR)     at _.extend.forEach (packages/mongo-livedata/mongo_driver.js:836)
W20140418-17:00:43.890(-7)? (STDERR)     at Cursor.(anonymous function) [as forEach] (packages/mongo-  
livedata/mongo_driver.js:695)
W20140418-17:00:43.890(-7)? (STDERR)     at app/server/publish.js:51:33
W20140418-17:00:43.890(-7)? (STDERR)     at Array.forEach (native)
W20140418-17:00:43.891(-7)? (STDERR)     at app/server/publish.js:49:19
W20140418-17:00:43.891(-7)? (STDERR)     at   
...packages/npm/.build/npm/node_modules/github/api/v3.0.0/issues.js:116:17
W20140418-17:00:43.891(-7)? (STDERR)     at IncomingMessage.<anonymous>   
(...packages/npm/.build/npm/node_modules/github/index.js:756:21)

私が最初に考えたのは、ノード ファイバーを使用することになっていたときに、どこかでコールバックを使用していたということでしたが、コードは比較的単純に見えます。

var repos = ['my-repo', 'my-repo-1',];
var pollGit = function() {

repos.forEach(function(repo) {
    github.issues.repoIssues({
        user: 'user',
        repo: repo
    }, function(err, stuff) {
        if (err) {
            throw err;
        }
        stuff.forEach(function (issue) {
            var sel = {git_id: issue.id};
            Tasks.find(sel).forEach(function (item) { //ERROR THROWN HERE
                console.log('got', item);
            });
        });
    });
 });
};

Meteor.startup(function() {
    pollGit();
});

このエラーは、find を呼び出した後に実際のオブジェクトを取得しようとするたびに発生します。find() を呼び出すだけで問題なく動作します。エラーの原因は正確には何ですか?

4

2 に答える 2