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:Jump to solution
You should use them if you have multiple processes, for example in a sharded bot
6 Replies
Solution
You should use them if you have multiple processes, for example in a sharded bot
can you give an example how to use both of them? thanks!
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
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, rightMhmm
As long as your app is single process, you can never have conflicts
thanks!