Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes lamassu-admin process when added to feed.js #3

Open
CrypticaScriptura opened this issue Mar 19, 2015 · 3 comments
Open

Crashes lamassu-admin process when added to feed.js #3

CrypticaScriptura opened this issue Mar 19, 2015 · 3 comments
Assignees

Comments

@CrypticaScriptura
Copy link
Contributor

When coinfloor is added as a source to lamassu-admin/server/price/feed.js, lamassu-admin process continuously restarts, displaying the following in lamassu-admin.log. Server is set to supported currency (USD).

Prevents it from being added as a default price source in the admin.

Starting SocketStream 0.3.10 in development mode...
Warning: connection.session() MemoryStore is not
designed for a production environment, as it will leak
memory, and will not scale past a single process.

/usr/local/lib/node_modules/lamassu-admin/server/price/feed.js:9
  return require('lamassu-' + ticker).ticker.factory();
                                             ^
TypeError: Object function (currencies, callback) {
        if (typeof currencies == "string") {
            currencies = [ currencies ];
        }
        var remaining = currencies.length;
        for (var i = 0; i < currencies.length; ++i) {
            var currency = currencies[i];
            if (!(currency in _tickers) && currency in assets_by_code) {
                var doWatch = (function (base, counter) {
                    return function () {
                        console.log("Coinfloor: Subscribing to ticker for " + base.code + ":" + counter.code);
                        Coinfloor.request({
                            method: "WatchTicker",
                            base: base.id,
                            counter: counter.id,
                            watch: true,
                        }, function (msg) {
                            if (msg.error_code == 0) {
                                msg.base = base.id;
                                msg.counter = counter.id;
                                Coinfloor.trigger("TickerChanged", msg);
                                if (!--remaining) {
                                    callback(null, _tickers);
                                    _ticker_callback = callback;
                                }
                            }
                        });
                    };
                })(_base, assets_by_code[currency]);
                Coinfloor.on("Welcome", doWatch);
                if (Coinfloor.isConnected()) {
                    doWatch();
                }
            }
            else if (!--remaining) {
                callback(null, _tickers);
                _ticker_callback = callback;
            }
        }
    } has no method 'factory'
    at /usr/local/lib/node_modules/lamassu-admin/server/price/feed.js:9:46
    at Array.map (native)
    at Object.<anonymous> (/usr/local/lib/node_modules/lamassu-admin/server/price/feed.js:8:31)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/lamassu-admin/app.js:62:18)
@CrypticaScriptura
Copy link
Contributor Author

Amended logs above.

@whitslack
Copy link

It would really be helpful if there were SPI documentation. Trying to implement a Rakía module as a third party is a guessing game without documentation.

@whitslack
Copy link

It appears that there are two different SPIs in play. lamassu-admin wants the lamassu-coinfloor module to have a property named ticker, whose value should be an object that has a method named factory that returns an instance of the ticker interface. However, lamassu-server wants the lamassu-coinfloor module to have a method named ticker — in other words, to implement the ticker interface directly. I can add glue code so that both of these SPIs are implemented, but this strikes me as haphazard and ill-defined. Could we get input from @joshmh as to which is the "correct" SPI?

A note: the string factory does not appear anywhere in lamassu-server@joshmh/master.

@whitslack whitslack self-assigned this Mar 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants