From 2d7b3a8eb1ec7038666d358bec85ca32b47b7735 Mon Sep 17 00:00:00 2001 From: zhangzihao Date: Sat, 23 Jan 2021 10:13:13 +0800 Subject: [PATCH] Change the timeout mechanism in inotify index. --- libsearch/index/inotify-index.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libsearch/index/inotify-index.cpp b/libsearch/index/inotify-index.cpp index 0c8d5c3..19b2df6 100644 --- a/libsearch/index/inotify-index.cpp +++ b/libsearch/index/inotify-index.cpp @@ -338,21 +338,21 @@ fork: int rc; timeval* read_timeout = (timeval*)malloc(sizeof(timeval)); + read_timeout->tv_sec = 60; + read_timeout->tv_usec = 0; for(;;) { FD_ZERO(&read_fds); FD_SET(m_fd, &read_fds); - read_timeout->tv_sec = 30; - read_timeout->tv_usec = 0; + qDebug() << read_timeout->tv_sec; rc = select(m_fd + 1, &read_fds, NULL, NULL, read_timeout); - if ( rc < 0 ) { // error - qDebug() << "rc < 0"; + qWarning() << "select result < 0, error!"; assert(false); } else if ( rc == 0 ) { - qDebug() << "timeout"; + qDebug() << "select timeout!"; _exit(0); }else{ numRead = read(m_fd, buf, BUF_LEN);