harvester/server/src/reharvesterao.cpp
branchRCL_3
changeset 19 b73252188534
parent 9 82c0024438c8
child 20 f23c07ec56e2
equal deleted inserted replaced
18:63c982fb92f2 19:b73252188534
    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     CMdEObject* mdeObject = &aItem->MdeObject();
   173     if( mdeObject )
   174     if( mdeObject )
   174     	{
   175     	{
   175     	delete mdeObject;
   176     	delete mdeObject;
       
   177     	mdeObject = NULL;
   176     	aItem->SetMdeObject( NULL );
   178     	aItem->SetMdeObject( NULL );
   177     	}
   179     	}
   178     
   180     
   179     iItems.Append( aItem );
   181     if(iItems.Append( aItem ) != KErrNone )
   180     
   182         {
       
   183         delete aItem;
       
   184         aItem = NULL;
       
   185         }
       
   186 
   181     iDelay = KResumeTime;
   187     iDelay = KResumeTime;
   182     const TTimeIntervalMicroSeconds32 delay = TTimeIntervalMicroSeconds32( iDelay );
   188     const TTimeIntervalMicroSeconds32 delay = TTimeIntervalMicroSeconds32( iDelay );
   183     
   189     
   184     if ( !IsActive() )
   190     if ( !IsActive() )
   185         {
   191         {
   204             continue;
   210             continue;
   205             }
   211             }
   206         // found matching item
   212         // found matching item
   207 	    iItems.Remove( i );
   213 	    iItems.Remove( i );
   208 	    delete item;
   214 	    delete item;
       
   215 	    item = NULL;
   209         }
   216         }
   210     
   217     
   211     if ( iItems.Count() == 0 )
   218     if ( iItems.Count() == 0 )
   212         {
   219         {
   213         WRITELOG( "CReHarvesterAO::CheckItem() - item count 0" );
   220         WRITELOG( "CReHarvesterAO::CheckItem() - item count 0" );