Index: pg_autovacuum.c =================================================================== RCS file: /projects/cvsroot/pgsql/contrib/pg_autovacuum/pg_autovacuum.c,v retrieving revision 1.28 diff -u -r1.28 pg_autovacuum.c --- pg_autovacuum.c 24 Jan 2005 00:13:38 -0000 1.28 +++ pg_autovacuum.c 24 Jan 2005 17:05:21 -0000 @@ -556,6 +556,7 @@ Dllist *db_list = DLNewList(); db_info *dbs = NULL; PGresult *res = NULL; + int j = 0; DLAddHead(db_list, DLNewElem(init_dbinfo((char *) "template1", 0, 0))); if (DLGetHead(db_list) == NULL) @@ -571,6 +572,27 @@ */ dbs = ((db_info *) DLE_VAL(DLGetHead(db_list))); dbs->conn = db_connect(dbs); + +#ifdef WIN32 + if (dbs->conn == NULL && !appMode) + { + /* Pause for 30 seconds to allow the database to start up */ + log_entry("Pausing 30 seconds to allow the database to startup completely", LVL_INFO); + fflush(LOGOUTPUT); + ServiceStatus.dwWaitHint = 10; + for (j=0; j<6; j++) + { + pg_usleep(5000000); + ServiceStatus.dwCheckPoint++; + SetServiceStatus(hStatus, &ServiceStatus); + fflush(LOGOUTPUT); + } + + /* now try again */ + log_entry("Attempting to connect again.", LVL_INFO); + dbs->conn = db_connect(dbs); + } +#endif if (dbs->conn != NULL) {