[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: Re: [nepomuk-core/feature/newIndexer] services/fileindexer: File Index Scheduler: Remove the concept
From: Sebastian TrĂ¼g <sebastian () trueg ! de>
Date: 2012-09-21 7:55:25
Message-ID: 505C1D6D.1060501 () trueg ! de
[Download RAW message or body]
Do you think this is a good idea. I originally introduced the speeds
because I found it very unproductive to never have anything indexed
while I was working. I would need to step away from the system in order
for my files to be indexed.
On 09/20/2012 11:40 PM, Vishesh Handa wrote:
> Git commit 1b7075da5aabc937cd4c56fb96ae560dbd557662 by Vishesh Handa.
> Committed on 13/09/2012 at 13:09.
> Pushed by vhanda into branch 'feature/newIndexer'.
>
> File Index Scheduler: Remove the concept of Indexing Speeds
>
> We can now only switch indexing on or off.
>
> When the system is being used, no files will be indexed. This detection
> is done via KIdleTime.
>
> M +4 -12 services/fileindexer/fileindexer.cpp
> M +3 -47 services/fileindexer/indexscheduler.cpp
> M +1 -40 services/fileindexer/indexscheduler.h
>
> http://commits.kde.org/nepomuk-core/1b7075da5aabc937cd4c56fb96ae560dbd557662
>
> diff --git a/services/fileindexer/fileindexer.cpp \
> b/services/fileindexer/fileindexer.cpp index 85d9c45..e619e50 100644
> --- a/services/fileindexer/fileindexer.cpp
> +++ b/services/fileindexer/fileindexer.cpp
> @@ -69,18 +69,13 @@ Nepomuk2::FileIndexer::FileIndexer( QObject* parent, const \
> QList<QVariant>& ) connect( m_indexScheduler, SIGNAL( indexingSuspended(bool) ),
> this, SIGNAL( statusStringChanged() ) );
>
> - // setup the indexer to index at snail speed for the first two minutes
> - // this is done for KDE startup - to not slow that down too much
> - m_indexScheduler->setIndexingSpeed( IndexScheduler::SnailPace );
> -
> // start initial indexing honoring the hidden config option to disable it
> + m_indexScheduler->suspend();
> if( FileIndexerConfig::self()->isInitialRun() || \
> !FileIndexerConfig::self()->initialUpdateDisabled() ) { \
> m_indexScheduler->updateAll(); }
>
> - // delayed init for the rest which uses IO and CPU
> - // FIXME: do not use a random delay value but wait for KDE to be started \
> completely (using the session manager)
> - QTimer::singleShot( 2*60*1000, this, SLOT( finishInitialization() ) );
> + QTimer::singleShot( 0, this, SLOT( finishInitialization() ) );
>
> // Connect some signals used in the DBus interface
> connect( this, SIGNAL( statusStringChanged() ),
> @@ -108,9 +103,6 @@ void Nepomuk2::FileIndexer::finishInitialization()
> connect( idleTime, SIGNAL(timeoutReached(int)), this, \
> SLOT(slotIdleTimeoutReached()) ); connect( idleTime, SIGNAL(resumingFromIdle()), \
> this, SLOT(slotIdleTimerResume()) );
> - // start out with reduced speed until the user is idle for 2 min
> - m_indexScheduler->setIndexingSpeed( IndexScheduler::ReducedSpeed );
> -
> // Creation of watches is a memory intensive process as a large number of
> // watch file descriptors need to be created ( one for each directory )
> updateWatches();
> @@ -118,13 +110,13 @@ void Nepomuk2::FileIndexer::finishInitialization()
>
> void Nepomuk2::FileIndexer::slotIdleTimeoutReached()
> {
> - m_indexScheduler->setIndexingSpeed( IndexScheduler::FullSpeed );
> + m_indexScheduler->resume();
> KIdleTime::instance()->catchNextResumeEvent();
> }
>
> void Nepomuk2::FileIndexer::slotIdleTimerResume()
> {
> - m_indexScheduler->setIndexingSpeed( IndexScheduler::ReducedSpeed );
> + m_indexScheduler->suspend();
> }
>
>
> diff --git a/services/fileindexer/indexscheduler.cpp \
> b/services/fileindexer/indexscheduler.cpp index 193b8be..6e81069 100644
> --- a/services/fileindexer/indexscheduler.cpp
> +++ b/services/fileindexer/indexscheduler.cpp
> @@ -60,9 +60,6 @@ using namespace Soprano::Vocabulary;
> using namespace Nepomuk2::Vocabulary;
>
> namespace {
> - const int s_reducedSpeedDelay = 500; // ms
> - const int s_snailPaceDelay = 3000; // ms
> -
> QHash<QString, QDateTime> getChildren( const QString& dir )
> {
> QHash<QString, QDateTime> children;
> @@ -164,7 +161,6 @@ Nepomuk2::IndexScheduler::IndexScheduler( QObject* parent )
> > QObject( parent ),
> m_suspended( false ),
> m_indexing( false ),
> - m_indexingDelay( 0 ),
> m_currentIndexerJob( 0 )
> {
> // remove old indexing error log
> @@ -222,29 +218,6 @@ void Nepomuk2::IndexScheduler::setSuspended( bool suspended )
> resume();
> }
>
> -
> -void Nepomuk2::IndexScheduler::setIndexingSpeed( IndexingSpeed speed )
> -{
> - kDebug() << speed;
> - m_indexingDelay = 0;
> - if ( speed != FullSpeed ) {
> - m_indexingDelay = (speed == ReducedSpeed) ? s_reducedSpeedDelay : \
> s_snailPaceDelay;
> - }
> - if( m_cleaner ) {
> - m_cleaner->setDelay(m_indexingDelay);
> - }
> -}
> -
> -
> -void Nepomuk2::IndexScheduler::setReducedIndexingSpeed( bool reduced )
> -{
> - if ( reduced )
> - setIndexingSpeed( ReducedSpeed );
> - else
> - setIndexingSpeed( FullSpeed );
> -}
> -
> -
> bool Nepomuk2::IndexScheduler::isSuspended() const
> {
> return m_suspended;
> @@ -448,10 +421,10 @@ void Nepomuk2::IndexScheduler::analyzeDir( const QString& \
> dir_, Nepomuk2::IndexS }
>
>
> -void Nepomuk2::IndexScheduler::callDoIndexing(bool noDelay)
> +void Nepomuk2::IndexScheduler::callDoIndexing()
> {
> if( !m_suspended ) {
> - QTimer::singleShot( noDelay ? 0 : m_indexingDelay, this, \
> SLOT(doIndexing()) ); + QTimer::singleShot( 0, this, SLOT(doIndexing()) );
> }
> }
>
> @@ -527,7 +500,7 @@ void Nepomuk2::IndexScheduler::analyzeFile( const QString& path \
> )
> // continue indexing without any delay. We want changes reflected as soon as \
> possible if( !m_indexing ) {
> - callDoIndexing(true);
> + callDoIndexing();
> }
> }
>
> @@ -542,21 +515,4 @@ void Nepomuk2::IndexScheduler::deleteEntries( const \
> QStringList& entries ) Nepomuk2::clearIndexedData(KUrl::List(entries));
> }
>
> -
> -QDebug Nepomuk2::operator<<( QDebug dbg, IndexScheduler::IndexingSpeed speed )
> -{
> - dbg << ( int )speed;
> - switch( speed ) {
> - case IndexScheduler::FullSpeed:
> - return dbg << "FullSpeed";
> - case IndexScheduler::ReducedSpeed:
> - return dbg << "ReducedSpeed";
> - case IndexScheduler::SnailPace:
> - return dbg << "SnailPace";
> - }
> -
> - // make gcc shut up
> - return dbg;
> -}
> -
> #include "indexscheduler.moc"
> diff --git a/services/fileindexer/indexscheduler.h \
> b/services/fileindexer/indexscheduler.h index 118dac2..5c39f03 100644
> --- a/services/fileindexer/indexscheduler.h
> +++ b/services/fileindexer/indexscheduler.h
> @@ -100,45 +100,10 @@ namespace Nepomuk2 {
> */
> UpdateDirFlags currentFlags() const;
>
> - enum IndexingSpeed {
> - /**
> - * Index at full speed, i.e. do not use any artificial
> - * delays.
> - *
> - * This is the mode used if the user is "away".
> - */
> - FullSpeed = 0,
> -
> - /**
> - * Reduce the indexing speed mildly. This is the normal
> - * mode used while the user works. The indexer uses small
> - * delay between indexing two files in order to keep the
> - * load on CPU and IO down.
> - */
> - ReducedSpeed,
> -
> - /**
> - * Like ReducedSpeed delays are used but they are much longer
> - * to get even less CPU and IO load. This mode is used for the
> - * first 2 minutes after startup to give the KDE session manager
> - * time to start up the KDE session rapidly.
> - */
> - SnailPace
> - };
> -
> public Q_SLOTS:
> void suspend();
> void resume();
>
> - void setIndexingSpeed( IndexingSpeed speed );
> -
> - /**
> - * A convenience slot which calls setIndexingSpeed
> - * with either FullSpeed or ReducedSpeed, based on the
> - * value of \p reduced.
> - */
> - void setReducedIndexingSpeed( bool reduced = false );
> -
> void setSuspended( bool );
>
> /**
> @@ -206,9 +171,8 @@ namespace Nepomuk2 {
>
> /**
> * Continue indexing async after waiting for the configured delay.
> - * \param noDelay If true indexing will be started immediately without any \
> delay.
> */
> - void callDoIndexing( bool noDelay = false );
> + void callDoIndexing();
>
> bool m_suspended;
> bool m_indexing;
> @@ -230,13 +194,10 @@ namespace Nepomuk2 {
> KUrl m_currentUrl;
> UpdateDirFlags m_currentFlags;
>
> - int m_indexingDelay;
> IndexCleaner* m_cleaner;
>
> Indexer* m_currentIndexerJob;
> };
> -
> - QDebug operator<<( QDebug dbg, IndexScheduler::IndexingSpeed speed );
> }
>
> Q_DECLARE_OPERATORS_FOR_FLAGS(Nepomuk2::IndexScheduler::UpdateDirFlags)
>
>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic