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

error using omeg-supreme method #13

Closed
siddo420 opened this issue Oct 16, 2015 · 13 comments
Closed

error using omeg-supreme method #13

siddo420 opened this issue Oct 16, 2015 · 13 comments

Comments

@siddo420
Copy link

I have added metroplex with omega-supreme.

  primus.use( 'omega-supreme',    require( 'omega-supreme'    )); // before metroplex
  primus.use( 'metroplex',        require( 'metroplex'        )); // registry/map 

Then, I have the following code snippet

primus.forward.sparks( sparks2send, 
                      msg,
                     function( err, results ){
        if( err ) {
          Logger.errorc( 'Error: ' + err  );
          return done( err, null );
                }
//  ........
});

The code above prints following error:

Error: Error: Invalid URI "/primus/omega/supreme"

Example list of sparks:

sparks2send = ["64xRm74gJ2dsMXVJAAAA","5iQsCn0grQ5EImWMAAAB","LBD9Vtykb5vo5qWrAAAB","UoA4Ir54PP9sCO-qAAAB","mlNYdagAleP1AzuJAAAA","xoc7pJzICFj1IlINAAAB","ffSiCA3n6HGVaUO5AAAA","Wi744PWyRCbmp5OfAAAI","nbIvK_GwjSLKGihtAAAA","eE5FnKSTBxNryBRXAAAA","BfadUHua5RZ3HVqEAAAA","ySd-xtbqgHo4gLNmAAAA","W5ioExC5VRKwcxB0AAAA","vnKVluWrieQP0jCSAAAA"]

I may be missing something in configuration I think:

  primus_options =   {  
        pathname:     '/primus'   // The URL namespace that Primus can own
      , parser:       'JSON'
      , transformer:  'engine.io'     
      , namespace:    'mp'        // for 'mp'=metroplex prefixed keys
      , address:      add
      , username:     'user'  
      , password:     'password'  
      , redis: Redis.getClient()
      , concurrently: 30 //How many servers can we broadcast to at once, defaults to 10
      , url: '/primus/omega/supreme'  //-->doesn't work with/without this option
   };
@lpinca
Copy link
Member

lpinca commented Oct 16, 2015

There was a bug that I've just fixed in 1afdc86 but it was unrelated to the issue you are reporting.
I was unable to reproduce your issue. In this gist you can find the test case I've used.

@siddo420
Copy link
Author

But, your test fails if an invalid/non-existent spark is given to primus.forward.sparks().

I made the following change to your server code and ran it again:

    sparks.push(spark.id);
    if (sparks.length !== 2) return;
    sparks.push('234fwfrewrw423#%#$'); //<---- added this line

Here is what happens as a result:

server listening on 0.0.0.0:3002
server listening on 0.0.0.0:3001
L1mXUWv connected
L1mXUX9 connected
/private/tmp/primus_test/node_modules/metroplex/node_modules/ioredis/node_modules/bluebird/js/main/async.js:43
        fn = function () { throw arg; };
                           ^
Error: Invalid URI "/primus/omega/supreme"   <-- same error
    at Request.init (/private/tmp/primus_test/node_modules/omega-supreme/node_modules/request/request.js:289:31)

This is a valid case because sparks can be disconnected anytime (even during the call to .forwards() method).

Also, if you decide to fix it, please make sure you return an array of results with one result item for each corresponding spark in the input array like you do for metroplex.sparks().

@siddo420
Copy link
Author

['L1mXUWv', 'L1mXUX9', '234fwfrewrw423#%#$']

So, if above is the input list of sparks and assuming that 3rd item is invalid/disconnected/non-existent, the output should be similar to:

[ 'ok','ok',null ]

@lpinca lpinca closed this as completed in 780c235 Oct 16, 2015
@lpinca
Copy link
Member

lpinca commented Oct 16, 2015

It should be fixed in master.

Also, if you decide to fix it, please make sure you return an array of results with one result item for each corresponding spark in the input array like you do for metroplex.sparks().

Unfortunately this is not possible as the return value is the info object returned by omega-supreme.

@siddo420
Copy link
Author

Should I create a new issue at omega-supreme?

This is important for client, so it could record the info in DB if the pkt was sent to a spark successfully or not (for re-attempts etc).

@lpinca
Copy link
Member

lpinca commented Oct 16, 2015

Yes, do it.

@siddo420
Copy link
Author

Done.
primus/omega-supreme#5

@siddo420
Copy link
Author

was 780c235 not added to the latest release?

@lpinca
Copy link
Member

lpinca commented Mar 19, 2016

nope.

@siddo420
Copy link
Author

when will it be done? And, what are we waiting for? I mean is it safe to get it from the repo directly?

@lpinca
Copy link
Member

lpinca commented Mar 19, 2016

The problem is that if we publish current master we will force people to use https://github.com/luin/ioredis.
If @3rd-Eden is ok I'll go ahead and publish [email protected].

You can safely install from GitHub in the meanwhile.

@3rd-Eden
Copy link
Member

@lpinca go for it.

@lpinca
Copy link
Member

lpinca commented Mar 19, 2016

Published [email protected].

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

3 participants