From 30d11e969bb2c99c4401953437eef1ff3fe32234 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Sun, 13 Jan 2008 17:46:44 +0000 Subject: changed queue shutdown procedure a bit - stage work for queue shutdown timeout setting --- queue.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'queue.c') diff --git a/queue.c b/queue.c index e3f10078..31d2d711 100644 --- a/queue.c +++ b/queue.c @@ -749,8 +749,6 @@ static rsRetVal queuePersist(queue_t *pThis) size_t lenQIFNam; assert(pThis != NULL); - if(pThis->qType != QUEUETYPE_DISK) - ABORT_FINALIZE(RS_RET_NOT_IMPLEMENTED); /* TODO: later... */ dbgprintf("Queue 0x%lx: persisting queue to disk, %d entries...\n", queueGetID(pThis), pThis->iQueueSize); /* Construct file name */ @@ -766,6 +764,9 @@ static rsRetVal queuePersist(queue_t *pThis) FINALIZE; /* nothing left to do, so be happy */ } + if(pThis->qType != QUEUETYPE_DISK) + ABORT_FINALIZE(RS_RET_NOT_IMPLEMENTED); /* TODO: later... */ + CHKiRet(strmConstruct(&psQIF)); CHKiRet(strmSetDir(psQIF, glblGetWorkDir(), strlen((char*)glblGetWorkDir()))); CHKiRet(strmSettOperationsMode(psQIF, STREAMMODE_WRITE)); @@ -816,9 +817,7 @@ rsRetVal queueChkPersist(queue_t *pThis) ISOBJ_TYPE_assert(pThis, queue); -dbgprintf("chkPersist: PersUpdCnt %d, UpdsSincePers %d\n", pThis->iPersistUpdCnt, pThis->iUpdsSincePersist); if(pThis->iPersistUpdCnt && ++pThis->iUpdsSincePersist >= pThis->iPersistUpdCnt) { -dbgprintf("persistintg queue info!\n"); queuePersist(pThis); pThis->iUpdsSincePersist = 0; } @@ -841,11 +840,9 @@ rsRetVal queueDestruct(queue_t *pThis) pThis->pWrkThrds = NULL; } - /* now check if we need to persist the queue */ - if(pThis->bImmediateShutdown) { - CHKiRet_Hdlr(queuePersist(pThis)) { - dbgprintf("Queue 0x%lx: error %d persisting queue - data lost!\n", (unsigned long) pThis, iRet); - } + /* persist the queue (we always do that - queuePersits() does cleanup it the queue is empty) */ + CHKiRet_Hdlr(queuePersist(pThis)) { + dbgprintf("Queue 0x%lx: error %d persisting queue - data lost!\n", (unsigned long) pThis, iRet); } /* ... then free resources */ -- cgit