小编Goo*_*ieK的帖子

Microsoft Graph API 间歇性错误“未找到令牌:令牌无效或已过期”在重试后自行解决

我正在向 Microsoft Graph REST api(测试版)发出请求,特别是向登录事件端点:https : //graph.microsoft.com/beta/auditLogs/signIns

我正在发出批处理请求,以 1000 个批次检索特定用户的登录信息。从 9 月 25 日左右开始,这些请求将在大约 10-50 个批次后失败,响应如下,HTTP 为 400(无效请求)错误代码:

"error": {
  "code": "",
  "message": "Token not found: token is either invalid or expired",
  "innerError": {
    "request-id": "[request-id-redacted]",
    "date": "2019-09-30T22:27:36"
  }
}
Run Code Online (Sandbox Code Playgroud)

但是,如果我在等待 ~1 秒后重试请求,使用完全相同的 JWT Web 令牌,请求会成功,并且我能够完成我正在运行的作业的所有批处理请求。我在最初进行身份验证时收到的访问令牌在 1 小时后到期,但是在我收到令牌后约 1-15 分钟出现此错误(我已确认使用令牌获得的 unix 时间戳到期日期)。

我想知道这个错误的原因可能是什么,以及我如何避免它,除了硬编码特定的响应消息并重试。我也无法在 google 上找到任何匹配的错误消息。有没有人以前从 Microsoft Graph API 中看到过这个错误?

azure-active-directory microsoft-graph-api

8
推荐指数
1
解决办法
415
查看次数

SQL查询的计算复杂性

如果我有一个博客帖子的表,有post_id和author_id这样的列,我使用SQL"SELECT*FROM post_table where author_id = 34",该查询的计算复杂度是多少?它是否只是查看每一行并检查它是否具有正确的作者ID,O(n),还是它做了更有效的事情?

我只是想知道因为我在这种情况下我可以使用这些数据搜索SQL数据库,或者加载带有帖子列表的xml文件,并搜索那些,我想知道哪个会更快.

sql sorting time-complexity

4
推荐指数
2
解决办法
3210
查看次数

比较constexpr-if条件中的constexpr函数参数会导致错误

我正在尝试比较constexpr-if语句中的函数参数.

这是一个简单的例子:

constexpr bool test_int(const int i) {
  if constexpr(i == 5) { return true; }
 else { return false; }
}
Run Code Online (Sandbox Code Playgroud)

但是,当我用GCC 7使用以下标志编译它时: g++-7 -std=c++1z test.cpp -o test 我收到以下错误消息:

test.cpp: In function 'constexpr bool test_int(int)':
test.cpp:3:21: error: 'i' is not a constant expression
 if constexpr(i == 5) { return true; }
Run Code Online (Sandbox Code Playgroud)

但是,如果我test_int用不同的功能替换:

constexpr bool test_int_no_if(const int i) { return (i == 5); }
Run Code Online (Sandbox Code Playgroud)

然后以下代码编译没有错误:

int main() {
  constexpr int i = 5;
  static_assert(test_int_no_if(i));
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

我不明白为什么constexpr-if版本无法编译,特别是因为static_assert工作正常. …

c++ static-assert constexpr c++17 if-constexpr

1
推荐指数
1
解决办法
661
查看次数