Snowflake support

Yo (english isnt my native lang) So I am planning to use snowflake id's in my own app, and I decided to use your package (@sapphire/snowflake) because it looks the best one (found it from djs). While researching the snowflake id's, as far as I understand, the worker id is included in the snowflake so there wont be any dublicates. And while I was browsing your code, I saw the options workerId and processId, how to use them? I mean, the backend is just expressjs, without workers or anything, i am planning to run a single instance on vps using pm2, or maybe use pm2 to create workers? so, i know that these options are optional, but still, how to use them? when should i use them?
Solution:
You should use them if you have multiple processes, for example in a sharded bot
Jump to solution
6 Replies
Solution
kyra
kyra2y ago
You should use them if you have multiple processes, for example in a sharded bot
Newbie
Newbie2y ago
can you give an example how to use both of them? thanks!
kyra
kyra2y ago
Not really to be honest, I'm not familiar with djs's ShardingManager. The idea is that you would set those IDs only if you use multiple workers and/or processes
Newbie
Newbie2y ago
ah yes, i understand now so if i am running my express server just by pm2 start index.js i dont need to edit these options and there wont be any duplicates, right
kyra
kyra2y ago
Mhmm As long as your app is single process, you can never have conflicts
Newbie
Newbie2y ago
thanks!
Want results from more Discord servers?
Add your server