【问题标题】:Meteor method waiting for subscriptions that aren't thereMeteor 方法等待不存在的订阅
【发布时间】:2017-02-09 05:30:26
【问题描述】:

我有一个 Meteor 方法 generateUserHash,它只是将一个 ID 传递给 Intercom 以取回用户哈希:

export const generateUserHash = new ValidatedMethod({
  name: 'generateUserHash',

  validate() {},

  run() {
    if (!Meteor.isServer) return;

    if (!this.userId) throw new Meteor.Error('no-user-id');

    return SecureMode.userHash({
      identifier: this.userId,
      secretKey: Meteor.settings.intercom.secretKey,
    });
  },
});

根据卡迪拉:

我不明白为什么它要等待所有这些订阅,而这些订阅不在方法中。

【问题讨论】:

  • 什么时候执行这个方法?当应用刚刚完成加载或根据用户操作的需求?
  • 它在 React 组件安装时运行。

标签: meteor meteor-methods kadira


【解决方案1】:

即使订阅不在该方法中,方法也会等待订阅。

关于等待时间的好帖子在这里:https://meteorhacks.com/understanding-meteor-wait-time-and-this-unblock/

【讨论】:

猜你喜欢
  • 2017-01-19
  • 2019-05-10
  • 2017-10-08
  • 2020-02-01
  • 1970-01-01
  • 1970-01-01
  • 2021-06-08
  • 2013-11-03
  • 1970-01-01
相关资源
最近更新 更多