CouchDB update_notification,nodejs

时间:2016-08-26 13:46:27

标签: javascript node.js couchdb

我有一个nodejs应用程序,我将其用作CouchDB实例的update_notification处理程序的外部进程。
nodejs应用程序负责从一些标准DB复制到新创建的DB。复制以某种方式工作,但nodejs应用程序被任意破坏。

这是应用程序监听通知处理程序的代码

var stdin = process.openStdin();


stdin.setEncoding('utf8');


stdin.on('data', function(d) {
    // Parsen des Ergebnis
    if (d !== null) {
        parsedData.push(JSON.parse(d));
    }
});

这是代码来自数组parsedData

的代码
var checker = function() {
    for (var index in parsedData) {
        var parsed = parsedData[index];
        if (parsed.type === "created" && parsed.db !== "design" && parsed.db !== "custom") {
            // start replication
        }
    }

    parsedData = [];

    setTimeout(checker, 1000);
};

这是错误日志

** Last message in was {#Port<0.36681>,{exit_status,8}}
** When Server state == {os_proc,"nodejs /config/db_create/init_db_helper.js",
                                 #Port<0.36681>,
                                 #Fun<couch_os_process.2.14837184>,
                                 #Fun<couch_os_process.3.14837184>,5000}
** Reason for termination == 
** {exit_status,8}

[Fri, 26 Aug 2016 13:35:07 GMT] [error] [<0.9594.0>] {error_report,<0.9237.0>,
                      {<0.9594.0>,crash_report,
                       [[{initial_call,
                          {couch_os_process,init,['Argument__1']}},
                         {pid,<0.9594.0>},
                         {registered_name,[]},
                         {error_info,
                          {exit,
                           {exit_status,8},
                           [{gen_server,terminate,6,
                             [{file,"gen_server.erl"},{line,744}]},
                            {proc_lib,init_p_do_apply,3,
                             [{file,"proc_lib.erl"},{line,239}]}]}},
                         {ancestors,
                          [couch_db_update,couch_primary_services,
                           couch_server_sup,<0.9238.0>]},
                         {messages,[]},
                         {links,[<0.9295.0>]},
                         {dictionary,[]},
                         {trap_exit,false},
                         {status,running},
                         {heap_size,987},
                         {stack_size,27},
                         {reductions,968}],
                        []]}}
[Fri, 26 Aug 2016 13:35:07 GMT] [error] [<0.9295.0>] Update notification process <0.9594.0> died: {exit_status,
                                                                   8}

当我在不同的网站上阅读时,外部进程必须处于无限循环中。但我不确定我的设置是否有点无限?

0 个答案:

没有答案