Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-27-2021 06:38 AM
Stack:
.NET Core 3.1
Causal Cluster Neo4j (3.5.14)
Neo4j Driver (1.7.0)
We are working on the social application where are loading video feeds from the neo4j and its working for some of the pagination and throw the connection error on random page. I have observed when I continually use the application it's working fine but if I remain idle for 2-3 mins and scroll the feeds then api throw the error. See below the exception
"One or more errors occurred. (Server at bolt+routing://IP:Port/ is no longer available due to error: Connection with the server breaks due to IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"
Code
Below mentioned is the Neo4j context class
public class Neo4jContext
{
private IDriver _driver;
private ConnectionString _connectionString;
public Neo4jContext(IOptions<ConnectionString> connectionString)
{
_connectionString = connectionString.Value;
if (_driver == null)
{
CreateDriver();
}
}
public void CreateDriver()
{
_driver = GraphDatabase.Driver(_connectionString.Server, AuthTokens.Basic(_connectionString.UserName, _connectionString.Password));
}
public ISession GetSession()
{
return _driver.Session();
}
}
Below is the code where i get the data after making the connection
using (var session = _context.GetSession())
{
var query = GetQuery(obj, ref parameters);
var response = session.Run(query, parameters);
result.Data = response.ToList();
result.Success = true;
return result;
}
All the sessions of the conference are now available online