我刚刚用一个express服务器设置了一个redis客户机,这样我就可以在redis存储中持久化用户会话数据。出于兴趣,我正在监视我的请求 cli
使用 monitor
命令查看通过express发出的请求。当用户登录时,我设置 userId
钥匙在 req.session
对象,请求将显示在cli上:
"set" "sess:2w8OkICwucsO9-18z_ghxA1FLH9GcWpx" "{\"cookie\":{\"originalMaxAge\":3600000,\"expires\":\"2020-10-09T12:09:37.604Z\",\"secure\":false,\"httpOnly\":true,\"path\":\"/\"}}" "EX" "3600"
但是在存储会话信息之后 get
以及 expire
命令显示为登录到cli:
1602241780.017805 [0 127.0.0.1:61201] "get" "sess:2w8OkICwucsO9-18z_ghxA1FLH9GcWpx"
1602241780.026601 [0 127.0.0.1:61201] "expire" "sess:2w8OkICwucsO9-18z_ghxA1FLH9GcWpx" "3600"
1602241783.014473 [0 127.0.0.1:61201] "get" "sess:2w8OkICwucsO9-18z_ghxA1FLH9GcWpx"
1602241783.020260 [0 127.0.0.1:61201] "expire" "sess:2w8OkICwucsO9-18z_ghxA1FLH9GcWpx" "3600"
1602241786.018502 [0 127.0.0.1:61201] "get" "sess:2w8OkICwucsO9-18z_ghxA1FLH9GcWpx"
1602241786.024512 [0 127.0.0.1:61201] "expire" "sess:2w8OkICwucsO9-18z_ghxA1FLH9GcWpx" "3600"
1602241789.018028 [0 127.0.0.1:61201] "get" "sess:2w8OkICwucsO9-18z_ghxA1FLH9GcWpx"
1602241789.023479 [0 127.0.0.1:61201] "expire" "sess:2w8OkICwucsO9-18z_ghxA1FLH9GcWpx" "3600"
这种情况每秒钟都在继续。。
我很确定我没有经常通过express调用任何函数,那么为什么 monitor
命令显示这些请求?
1条答案
按热度按时间cygmwpex1#
问题是每2秒执行一次内省查询的graphql。我在“设置”选项卡中禁用了该设置,它成功了!