1
0
mirror of synced 2026-02-21 20:37:55 +08:00
Files
SnowFlake-IdGenerator/NodeJs/test/test.js
布宝 8ff4e43338 Node (#1)
* Node

* add readme

* add .gitignore

* update cherry id
2021-06-28 16:29:23 +08:00

21 lines
476 B
JavaScript

/**
* @description:
* @author: bubao
* @date: 2021-04-27 17:23:36
* @last author: bubao
* @last edit time: 2021-04-28 10:34:24
*/
const GenId = require('..')
const Redis = require("ioredis");
const config = require("../env.config.js");
const redis = new Redis(config);
const genid = new GenId({ WorkerId: (process.argv[2] || 1) - 0 });
(async () => {
for (let index = 0; index < 5000; index++) {
await redis.sadd("setTest", genid.NextId());
}
redis.end();
})();