Skip to content

Commit

Permalink
delay create index data with application start
Browse files Browse the repository at this point in the history
防止在系统启动时创建索引占用io而导致桌面环境启动变慢
默认设置延迟10分钟
  • Loading branch information
zccrs committed May 23, 2019
1 parent 7708680 commit 35cb0a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion server/lib/lftmanager.cpp
Expand Up @@ -1148,7 +1148,7 @@ LFTManager::LFTManager(QObject *parent)
_cleanAllIndex();

if (_isAutoIndexPartition())
_indexAll();
_indexAllDelay();
#endif

connect(LFTDiskTool::diskManager(), &DDiskManager::mountAdded,
Expand Down Expand Up @@ -1217,6 +1217,12 @@ void LFTManager::_indexAll()
}
}

// 不要立马自动生成索引,防止刚开机时和其它进程抢占io
void LFTManager::_indexAllDelay(int time)
{
QTimer::singleShot(time, this, &LFTManager::_indexAll);
}

void LFTManager::_cleanAllIndex()
{
// 清理无效的路径
Expand Down
1 change: 1 addition & 0 deletions server/lib/lftmanager.h
Expand Up @@ -89,6 +89,7 @@ public Q_SLOTS:

void _syncAll();
void _indexAll();
void _indexAllDelay(int time = 10 * 60 * 1000);
void _cleanAllIndex();
void _addPathByPartition(const DBlockDevice *block);
void onMountAdded(const QString &blockDevicePath, const QByteArray &mountPoint);
Expand Down

0 comments on commit 35cb0a9

Please sign in to comment.