Skip to content

Commit

Permalink
Only process sockets after loading the db when using db_sql{_live}.
Browse files Browse the repository at this point in the history
This avoids slow startups for the 95% of users who are using the
db_flatfile database backend.
  • Loading branch information
SadieCat committed Nov 19, 2024
1 parent de16238 commit 7083c42
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 8 additions & 0 deletions modules/database/db_sql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ class DBSQL : public Module, public Pipe
this->import = block->Get<bool>("import");
}

void OnPostInit() anope_override
{
// If we are importing from flatfile we need to force a socket engine
// flush to ensure it actually gets written to the database before we
// connect to the uplink.
SocketEngine::Process();
}

void OnShutdown() anope_override
{
this->shutting_down = true;
Expand Down
1 change: 0 additions & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,6 @@ void Anope::Init(int ac, char **av)
EventReturn MOD_RESULT;
FOREACH_RESULT(OnLoadDatabase, MOD_RESULT, ());
static_cast<void>(MOD_RESULT);
SocketEngine::Process();
Log() << "Databases loaded";

FOREACH_MOD(OnPostInit, ());
Expand Down

0 comments on commit 7083c42

Please sign in to comment.