#Snowflake support

1 messages · Page 1 of 1 (latest)

autumn yew
#

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?

dusty parcelBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

quick urchin
#

You should use them if you have multiple processes, for example in a sharded bot

autumn yew
quick urchin
#

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

autumn yew
#

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

quick urchin
#

Mhmm

#

As long as your app is single process, you can never have conflicts

autumn yew
#

thanks!