kaelzhang / egg-snowflake

Egg plugin to generate unique and increased twitter-snowflake uuid.
MIT License
8 stars 0 forks source link

egg 里使用一直返回不了结果 #3

Open jedhu0 opened 6 years ago

jedhu0 commented 6 years ago

按教程配置了,但是貌似会陷入死循环,一直 hold 住

plugin.js

exports.snowflake = {
  enable: true,
  package: 'egg-snowflake',
};

config.default.js

 config.snowflake = {
    client: {
      machineId: 1,
      // `Number` if 6-bit length (the default value),
      // we could handle servers from `2 ** 6` different machines.
      // And if 0, there will be no machine id in the uuid
      machineIdBitLength: 6,
      workerIdBitLength: 4,
      // Could handle max 4096 requests per millisecond
      serialIdBitLength: 12,
    },
  };

model 使用

 const out_id = await app.snowflake.uuid();
 console.log(out_id);
jedhu0 commented 6 years ago

是因为跑测试,没生成 agent , 然后 index 的问题?

callmesoul commented 4 years ago

我也用不了,能找到snowflake ,但snowflake.uuid() 没返回

binBBB commented 1 year ago

是因为跑测试,没生成 agent , 然后 index 的问题?

兄弟是怎么解决的吗?

kaelzhang commented 1 year ago

The lib works for the cluster mode of egg with agent support