Skip to content

Commit

Permalink
fix: Slow log timestamp format is inconsistent with Redis (#2212)
Browse files Browse the repository at this point in the history
* Fixed the slow log timestamp format is inconsistent with Redis (#2206)

* Fixed the slow log timestamp format is inconsistent with Redis (#2206)
  • Loading branch information
chenbt-hz authored and brother-jin committed Dec 27, 2023
1 parent a3f1702 commit a15d26a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/pika_client_conn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ std::shared_ptr<Cmd> PikaClientConn::DoCmd(const PikaCmdArgsType& argv, const st

void PikaClientConn::ProcessSlowlog(const PikaCmdArgsType& argv, uint64_t do_duration) {
if (time_stat_->total_time() > g_pika_conf->slowlog_slower_than()) {
g_pika_server->SlowlogPushEntry(argv, time_stat_->start_ts(), time_stat_->total_time());
g_pika_server->SlowlogPushEntry(argv, time_stat_->start_ts() / 1000000, time_stat_->total_time());
if (g_pika_conf->slowlog_write_errorlog()) {
bool trim = false;
std::string slow_log;
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/slowlog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ var _ = Describe("Slowlog Commands", func() {
Expect(err).NotTo(HaveOccurred())

for i := 0; i < 10; i++ {
Expect(isBetween(time1.UnixNano(), time2.UnixNano(), time.Unix(0, result[i].Time.Unix()*1e3).UnixNano())).To(Equal(true))
Expect(result[i].Time.Unix()).To(BeNumerically("~", 0, 9999999999))
Expect(isBetween(time1.Unix(), time2.Unix(), result[i].Time.Unix())).To(Equal(true))
}
})
})
Expand Down

0 comments on commit a15d26a

Please sign in to comment.