Memoized runtime_env in order to prevent premature garbage collection of Env instance, which leads to pidfile getting deleted while resque-scheduler is still running.

The premature deletion of the pidfile, in my experience, happens on RedHat 5.5, but does not happen on RedHat 6.5.
Ha, you’re right.  I did that locally, but not when I did it on the github copy.  I’ll fix it.

Matt Johnsen
Lead Developer
Tangent Energy Solutions
PO Box 1140 206 Gale Lane Suite C
Kennett Square, PA 19348
(610) 444-2800 x210

From: Matteo Centenaro <notifications@github.com<mailto:notifications@github.com>>
Reply-To: resque/resque-scheduler <reply@reply.github.com<mailto:reply@reply.github.com>>
Date: Monday, November 10, 2014 at 11:38 AM
To: resque/resque-scheduler <resque-scheduler@noreply.github.com<mailto:resque-scheduler@noreply.github.com>>
Cc: Matt Johnsen <mjohnsen@tangentenergy.com<mailto:mjohnsen@tangentenergy.com>>
Subject: Re: [resque-scheduler] Memoized runtime_env in order to prevent premature garbage collection of Env instance, which leads to pidfile getting deleted while resque-scheduler is still running. (#454)


In lib/resque/scheduler/cli.rb:

> @@ -122,7 +122,7 @@ def run_forever
>        attr_reader :argv, :env
>
>        def runtime_env
> -        Resque::Scheduler::Env.new(options)
> +        @runtime_env = Resque::Scheduler::Env.new(options)


I think you're missing an || here. I suppose you wanted to do the following:

@runtime_env ||= Resque::Scheduler::Env.new(options)


—
Reply to this email directly or view it on GitHub<https://github.com/resque/resque-scheduler/pull/454/files#r20093383>.