GithubHelp home page GithubHelp logo

Comments (5)

pieceofsummer avatar pieceofsummer commented on August 22, 2024

Which redis storage provider are you using? Is it Hangfire.Pro.Redis, or Hangfire.Redis.StackExchange, or a legacy Hangfire.Redis?

from hangfire.console.

brad-jones avatar brad-jones commented on August 22, 2024

StackExchange

from hangfire.console.

pieceofsummer avatar pieceofsummer commented on August 22, 2024

Sorry, cannot reproduce it within a template .net core app with Hangfire 1.6.14, Hangfire.Redis.StackExchange 1.7.0 and Hangfire.Console 1.3.3.

Startup.cs:

    public class Startup
    {
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddHangfire(config =>
            {
                config.UseRedisStorage("127.0.0.1:6379,defaultDatabase=2,allowAdmin=true,syncTimeout=15000");
                config.UseConsole();
            });
        }

        public static async Task Execute(PerformContext ctx, IJobCancellationToken cancellationToken)
        {
            var things = new[] { 1, 2, 3, 4, 5 };

            foreach (var thing in things)
            {
                cancellationToken.ThrowIfCancellationRequested();
                Thread.Sleep(TimeSpan.FromSeconds(1));
                ctx.WriteLine($"Do something with the thing: {thing}");
            }
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseHangfireDashboard();
            app.UseHangfireServer();

            app.Run(async (context) =>
            {
                BackgroundJob.Enqueue(() => Execute(null, null));
                await context.Response.WriteAsync("Hello World!");
            });
        }
    }

Result:
screen shot 2017-07-06 at 17 49 23

Can you provide some more details on your environment?

from hangfire.console.

brad-jones avatar brad-jones commented on August 22, 2024

Ok fair enough, I'll setup a testable example and send you the repo details.
Might take me a couple of days to get it done.
Thanks very much for your efforts thus far.

from hangfire.console.

brad-jones avatar brad-jones commented on August 22, 2024

I setup a local environment and like yourself was unable to replicate the issue. In production we are running on AWS with an RDS instance of Redis.

After playing with some of the Redis timeout settings (https://stackexchange.github.io/StackExchange.Redis/Configuration) I managed to get it to work as expected.

Increasing the "SyncTimeout" value from 1 second to 10 seconds has solved the issue for me.
10 seconds is probably a little excessive and with more testing and tweaking, I imagine I'll be able to drop that value back down significantly.

from hangfire.console.

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.