diff --git a/server/lib/lftmanager.cpp b/server/lib/lftmanager.cpp index 9cce3db..1e86759 100644 --- a/server/lib/lftmanager.cpp +++ b/server/lib/lftmanager.cpp @@ -1148,7 +1148,7 @@ LFTManager::LFTManager(QObject *parent) _cleanAllIndex(); if (_isAutoIndexPartition()) - _indexAll(); + _indexAllDelay(); #endif connect(LFTDiskTool::diskManager(), &DDiskManager::mountAdded, @@ -1217,6 +1217,12 @@ void LFTManager::_indexAll() } } +// 不要立马自动生成索引,防止刚开机时和其它进程抢占io +void LFTManager::_indexAllDelay(int time) +{ + QTimer::singleShot(time, this, &LFTManager::_indexAll); +} + void LFTManager::_cleanAllIndex() { // 清理无效的路径 diff --git a/server/lib/lftmanager.h b/server/lib/lftmanager.h index 275d9e6..6bf0148 100644 --- a/server/lib/lftmanager.h +++ b/server/lib/lftmanager.h @@ -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);