harvester/server/src/reharvesterao.cpp
changeset 54 a3cc46f37772
parent 23 33ae025ac1e8
equal deleted inserted replaced
36:aa5a574040a4 54:a3cc46f37772
    17 #include "reharvesterao.h"
    17 #include "reharvesterao.h"
    18 #include "harvesterlog.h"
    18 #include "harvesterlog.h"
    19 #include "mdeobject.h"
    19 #include "mdeobject.h"
    20 #include "mdsutils.h"
    20 #include "mdsutils.h"
    21 
    21 
    22 const TInt KResumeTime = 2000000;  //microseconds
    22 const TInt KResumeTime = 3000000;  //microseconds
    23 const TInt KTimeIncrease = 500000; //microseconds
    23 const TInt KTimeIncrease = 1000000; //microseconds
    24 const TInt KTimeLimit = 30000000;    //microseconds
    24 const TInt KTimeLimit = 30000000;    //microseconds
    25 
    25 
    26 // ---------------------------------------------------------------------------
    26 // ---------------------------------------------------------------------------
    27 // NewLC
    27 // NewLC
    28 // ---------------------------------------------------------------------------
    28 // ---------------------------------------------------------------------------
   163             {
   163             {
   164 #ifdef _DEBUG
   164 #ifdef _DEBUG
   165             WRITELOG1("CReHarvesterAO::AddItem() - %S already exists in re-harvester queue", &aItem->Uri() );
   165             WRITELOG1("CReHarvesterAO::AddItem() - %S already exists in re-harvester queue", &aItem->Uri() );
   166 #endif
   166 #endif
   167             delete aItem;
   167             delete aItem;
       
   168             aItem = NULL;
   168             return;
   169             return;
   169             }
   170             }
   170         }
   171         }
   171     
   172     
   172     CMdEObject* mdeObject = &aItem->MdeObject();
   173     aItem->SetMdeObject( NULL );
   173     if( mdeObject )
   174     
   174     	{
   175     if(iItems.Append( aItem ) != KErrNone )
   175     	delete mdeObject;
   176         {
   176     	aItem->SetMdeObject( NULL );
   177         delete aItem;
   177     	}
   178         aItem = NULL;
   178     
   179         }
   179     iItems.Append( aItem );
   180 
   180     
       
   181     iDelay = KResumeTime;
   181     iDelay = KResumeTime;
   182     const TTimeIntervalMicroSeconds32 delay = TTimeIntervalMicroSeconds32( iDelay );
   182     const TTimeIntervalMicroSeconds32 delay = TTimeIntervalMicroSeconds32( iDelay );
   183     
   183     
   184     if ( !IsActive() )
   184     if ( !IsActive() )
   185         {
   185         {
   204             continue;
   204             continue;
   205             }
   205             }
   206         // found matching item
   206         // found matching item
   207 	    iItems.Remove( i );
   207 	    iItems.Remove( i );
   208 	    delete item;
   208 	    delete item;
       
   209 	    item = NULL;
   209         }
   210         }
   210     
   211     
   211     if ( iItems.Count() == 0 )
   212     if ( iItems.Count() == 0 )
   212         {
   213         {
   213         WRITELOG( "CReHarvesterAO::CheckItem() - item count 0" );
   214         WRITELOG( "CReHarvesterAO::CheckItem() - item count 0" );