Skip to content
This repository was archived by the owner on Sep 4, 2024. It is now read-only.

Update is-master.js to promises for mongoose 8/mongodb 6#21

Closed
caub wants to merge 1 commit into
mattpker:masterfrom
caub:patch-2
Closed

Update is-master.js to promises for mongoose 8/mongodb 6#21
caub wants to merge 1 commit into
mattpker:masterfrom
caub:patch-2

Conversation

@caub

@caub caub commented Aug 26, 2024

Copy link
Copy Markdown

Mongoose 8 doesn't support callback style in .save(), .findOne(), .updateOne() so we really need this update

@caub

caub commented Aug 26, 2024

Copy link
Copy Markdown
Author

@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

@markstos

Copy link
Copy Markdown

@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.

@caub

caub commented Aug 27, 2024

Copy link
Copy Markdown
Author

oh sorry, @mattpker is the owner, maybe he would merge and release with a minor/major version upgrade (both works)

Otherwise, we'll fork and publish to npm with a @scope probably (also adding #20)

@caub

caub commented Aug 30, 2024

Copy link
Copy Markdown
Author

@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

@mattpker

Copy link
Copy Markdown
Owner

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 node-is-leader. I will then update the README.md to point to your fork and then archive this repo.

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.

@markstos

Copy link
Copy Markdown

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.

@markstos

Copy link
Copy Markdown

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?

@caub

caub commented Sep 4, 2024

Copy link
Copy Markdown
Author

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

@markstos

markstos commented Sep 4, 2024

Copy link
Copy Markdown

Thanks @caub ! You've got your first Github star.

@mattpker

mattpker commented Sep 4, 2024

Copy link
Copy Markdown
Owner

Thanks @caub!! I have updated the README.md to point to the new location. I will be archiving this repo.

@mattpker mattpker closed this Sep 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants