Update is-master.js to promises for mongoose 8/mongodb 6#21
Conversation
|
@markstos Hey, we are upgrading our stack to mongoose 8, and we need to upgrade this lib too, is this possible, or should we fork it? Btw this update also works with mongoose 5 |
|
@caub I'm not the author, but I think you should fork it. My company needs this update, too, so your fork would have at least one other user. |
|
@mattpker Hey man, sorry but would you be able to merge this stuff? and deploy to npm? So you keep the credit of this awesome repo (really useful for us in Heroku, for running a job runner, I work for Storeganise.com) If you want you can add me as collaborator in GH/npm to manage this for you Thanks let us know |
|
Hey @caub, sorry for the late reply, been really busy. To be honest, I have moved on from NodeJS for many years now. I'm not really setup in a way to be able to test these changes and I can't even remember how I published to NPM lol. I also really don't like the name of this package anymore and I'd like to just get rid of it but I didn't want to stop anyones applications from working by deleting the repo or removing the package off of NPM. My suggestion to you would be to fork this and rename it to something more appropriate like I would also maybe look into other more resilient ways to handle something like this, such as the raft protocol. Most of the industry seems to be moving to this for a way to elect a leader. |
|
To bikeshed, MongoDB uses the primary/secondary language. That could be a precedent to consider following. My company is also moving away from using master/slave language and would also endorse the fork-and-rename proposal. |
|
Here's an example of a NPM module that uses the Raft algorithm to elect a leader. I have not tried. In favor of using the term "leader" is that it would be consistent Raft semantics: https://www.npmjs.com/package/tinyraft A module could be created which wraps this one and uses Mongoose/MongoDB as a backend, if something like that doesn't already exist. If a new architecture of this module was attempted, I would be interested to see if we could speed up the initial election improving the failover time. Maybe that's only a matter of defining what the heartbeat duration is between checks? |
|
Thanks guys for the suggestions, we went for https://github.com/caub/node-is-primary, published to npm too https://www.npmjs.com/package/is-primary |
|
Thanks @caub ! You've got your first Github star. |
|
Thanks @caub!! I have updated the |
Mongoose 8 doesn't support callback style in .save(), .findOne(), .updateOne() so we really need this update