Results 1 to 3 of 3
  1. #1

    Plugins seem to stop working after awhile (still partially works)

    Hello so i noticed that some of my plugins the ones i've been making that is, seem to "stop" after awhile whereby anything that requires it to get information from a database - no longer seems to function. I currently have the plugin setup in a way that the database connection is "always connected" whilst the plugin is enabled, could this be the problem? the connection is timing out ?

  2. #2
    Yes it is. The way the connection pooling is intended to work is open connection -> use -> close connection, for each separate group of transactions. The only things that should be under the same connection are groups of operations that should complete around the same time, otherwise the connection should be closed again.

    I tried doing my own pooling at first too, until i realized the system automatically does it and much better than my method. Use this.

    using (MySqlConnection connection = createAndOpenNewMySqlConnectionHere)
    //Single command, duplicate as needed for more commands using the same connection
    using (MySqlCommand command = connection.CreateCommand())

    The outer using clause will automatically close the connection after the ending bracket.

  3. #3



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts