more fixes for restart collection bug

This commit is contained in:
mwells 2014-04-11 00:10:33 -07:00
parent 04d2d46f0d
commit 5206c272cc

View File

@ -429,7 +429,7 @@ bool CommandRestartColl ( char *rec , WaitEntry *we ) {
CollectionRec *cr = g_collectiondb.getRec ( newCollnum );
// if reset from crawlbot api page then enable spiders
// to avoid user confusion
//if ( cr ) cr->m_spideringEnabled = 1;
if ( cr ) cr->m_spideringEnabled = 1;
if ( ! cr ) return true;
@ -441,7 +441,7 @@ bool CommandRestartColl ( char *rec , WaitEntry *we ) {
// do not let it have the buf any more
cr->m_siteListBuf.detachBuf();
// can't leave it NULL, safebuf parms do not like to be null
cr->m_siteListBuf.pushChar('\0');
cr->m_siteListBuf.nullTerm();
// re-add the buf so it re-seeds spiderdb. it will not dedup these
// urls in "oldSiteList" with "m_siteListBuf" which is now empty.
// "true" = addSeeds.
@ -485,10 +485,28 @@ bool CommandResetColl ( char *rec , WaitEntry *we ) {
// turn on spiders on new collrec. collname is same but collnum
// will be different.
//CollectionRec *cr = g_collectiondb.getRec ( newCollnum );
// if reset from crawlbot api page then enable spiders
// to avoid user confusion
//if ( cr ) cr->m_spideringEnabled = 1;
CollectionRec *cr = g_collectiondb.getRec ( newCollnum );
if ( ! cr ) return true;
//
// repopulate spiderdb with the same sites
//
char *oldSiteList = cr->m_siteListBuf.getBufStart();
// do not let it have the buf any more
cr->m_siteListBuf.detachBuf();
// can't leave it NULL, safebuf parms do not like to be null
cr->m_siteListBuf.nullTerm();
// re-add the buf so it re-seeds spiderdb. it will not dedup these
// urls in "oldSiteList" with "m_siteListBuf" which is now empty.
// "true" = addSeeds.
updateSiteListTables ( newCollnum , true , oldSiteList );
// now put it back
if ( oldSiteList ) cr->m_siteListBuf.safeStrcpy ( oldSiteList );
// turn spiders off
if ( cr ) cr->m_spideringEnabled = 0;
return true;
}