I have a method that requests data to the bank and in this same method I call another method that also requests the bank (mySql).
public class Viagem
{
public int idViagem { get; set; }
...
public Cidade origem { get; set; }
public List<Viagem> getViagens(int p)
{
Connection con = new Connection();
string query = @"SELECT * FROM viagem"
if (con.connect())
{
using (MySqlCommand cmd = new MySqlCommand(query, con.getConnection()))
{
MySqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
Viagem viagem = new Viagem();
Cidade cidade = new Cidade();
...
viagem.origem = cidade.getCidade(Convert.toInt32(reader["cidade"]));
}
}
}
The getCity method has the behavior similar to this getVariations. So when I have so-nested calls it's taking too long on the GODADDY server, I have similar codes on other servers the problem does not happen. It's taking me over 30 seconds to return 20 instances.
Do I need to configure something on the server for it to do pooling correctly?
Edited: The problem always occurs when I make the first request, the others, even if the values change, occurs in an expected time. Any suggestions?
Resolved: Godaddy sets session time in 5 minutes, disconnecting non-active users by this time, so the first request always took too long, the server having to leave the standby, to only then make the requisition. The solution will create a task within the hosting itself so that it would be requesting a page every 4 minutes and keeping the server "awake".