15
Veleon
5y

I just wrote a function that creates a configuration struct that is stored in a Singleton struct, but to create it I called the Singleton to get a connection to the database.

This created an infinite recursive function that maximized connections on the database, as the Singleton never got fully initialized. Not a good idea.

So to fix this I created the configuration after the creation of the Singleton, still calling the singleton from within the function. This worked.

Then I remembered that I could have just passed the connection as a parameter to the function. Like I've done a million times before...

It's time for the weekend, I need a break

Comments
Add Comment