Javascript 执行meteor重置时,已登录用户的应用程序页面冻结

Javascript 执行meteor重置时,已登录用户的应用程序页面冻结,javascript,meteor,iron-router,Javascript,Meteor,Iron Router,当我拥有活动的Meteor登录令牌并使用Meteor reset执行DB drop时,应用程序页面在重新加载时会严重冻结。感觉页面一直在加载,尽管页面上没有我可以交互的内容。浏览器控制台也挂起。在Chrome和Firefox上测试,面临相同的行为。 但是,当我尝试删除应用程序域的缓存时(通过浏览器设置,因为开发工具是无意识的),一切都正常了,我被重定向到一个登录页面(如我的路由配置中提供的),浏览器控制台显示以下消息:您已被服务器注销。请重新登录。 这是我的Iron路由器全球行动前挂钩: Rou

当我拥有活动的Meteor登录令牌并使用Meteor reset执行DB drop时,应用程序页面在重新加载时会严重冻结。感觉页面一直在加载,尽管页面上没有我可以交互的内容。浏览器控制台也挂起。在Chrome和Firefox上测试,面临相同的行为。 但是,当我尝试删除应用程序域的缓存时(通过浏览器设置,因为开发工具是无意识的),一切都正常了,我被重定向到一个登录页面(如我的路由配置中提供的),浏览器控制台显示以下消息:
您已被服务器注销。请重新登录
。 这是我的Iron路由器全球行动前挂钩:

Router.onBeforeAction(function () {

document.documentElement.className = 'gt-ie8 gt-ie9';

var currentUser = Meteor.user(),
    currentRoute = this.route.getName(),
    routeOptions = {},
    userRoles,
    userCompany, userTeam,
    allowedRoutes;

// prevent not logged in user from visiting the app
// console.log(this.next);
if (!currentUser) {
  this.redirect('login');
  // return;
} else {

  userRoles = currentUser.roles;

  userRoles = userRoles.length ? userRoles : ['member'];
  userCompany = currentUser.companyId || null;
  userTeam = currentUser.teamId || null;

  // get current user allowed routes (for highest role)
  allowedRoutes = _.filter(SW.roles, function (appRoute, index) {
    return userRoles.indexOf(index) > -1;
  });
  allowedRoutes = allowedRoutes && allowedRoutes.length ? allowedRoutes[0].routes : [];

  // if not all routes are allowed
  if (allowedRoutes.indexOf('*') === -1) {
    // restrict if route is not allowed
    if (!allowedRoutes.length || allowedRoutes.indexOf(currentRoute) === -1) {
      this.redirect('member.self');
    }
  }

}

this.next();

}, {
  except: ['enroll', 'login', 'logout']
});

我还需要提到的是,这是一个非常奇怪的拖拉问题,在生产服务器上发生的频率远远高于在执行本地测试时发生的频率。

这个问题似乎随着最新的Meteor更新(1.0.2.1)而消失。不过,这可能是因为我在我的项目中使用了Fast Render(在2.1.0中已修复)。

您在生产服务器上使用的是
meteor reset
?问题是这会关闭Meteor服务器,断开任何用户的连接。如果您更新代码并让Meteor按正常方式热重新加载,除非热重新加载超时,否则不会发生这种情况。@sbking我正在本地使用
Meteor reset
,在这种情况下,它会在某个时间发生。虽然在生产环境中,有一个脚本在部署后删除数据库,但它往往更频繁地出现在那个里。在一些更改之后,我必须执行数据库删除,这就是问题所在。