Git Product home page Git Product logo

Comments (5)

geinerjpc avatar geinerjpc commented on August 12, 2024 1

Thanks again!!!
1 server, 3 workers

I will try your recommendation, assuming you said:
c.UseConnectionFactory(MyOwnConnFactory)

from hangfire.postgresql.

geinerjpc avatar geinerjpc commented on August 12, 2024 1

Using connection factory works!!!

Thank you!!!

from hangfire.postgresql.

azygis avatar azygis commented on August 12, 2024

Heya.

This is a blind-and-untested code which you might try, assuming you have set up the services according to Npgsql docs.

services.AddHangfire((provider, config) =>
    config.UsePostgreSqlStorage(c =>
        c.UseExistingNpgsqlConnection(provider.GetRequiredSerice<NpgsqlConnection>())));

from hangfire.postgresql.

geinerjpc avatar geinerjpc commented on August 12, 2024

Hi, thanks
Yes I am testing your solution, it works.
I used service key to distinguish between different sources:

services.AddHangfire((provider, config) =>
    config.UsePostgreSqlStorage(c =>
        c.UseExistingNpgsqlConnection(provider.GetRequiredKeyService<NpgsqlConnection>(DataBaseKeyEnum.Name))));

In this way I can access my connection!

What a notice is that now keep showings a lot of warnings: "Could not place a lock on the resource 'hangfire:lock:recurring-job:ResetCheckIn' : Lock timeout"
But I ran a job and works, It is normal?

from hangfire.postgresql.

azygis avatar azygis commented on August 12, 2024

Hmm, no, this is not normal. How many servers (and workers) do you have active at the same time?

I have to admit I never really used the UseExistingNpgsqlConnection directly, but rather the UseConnectionFactory. I suggest to use that to handle the connection creation instead of an explicit existing connection. Existing has different dispose mechanics which might be interfering.

The interface is pretty straight forward - inject NpgsqlDataSource and just create the connection from your data source in the method. This way the connection will be created from the source and disposed internally as it's treated as Hangfire-created connection.

from hangfire.postgresql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.