On 3 March 2017 at 22:39, Joe Guerra <
JGu...@jginfosys.com> wrote:
> ok, I thought about that. Would it be ok to like set the instant variable
> to a global and use that?
>
> $remaining = @remaining
>
> I tried that, and it seems to have worked. I not sure if it's the best
> practice though.
Definitely not. In addition to the fact that presumable @remaining is
different for different products, and a request for a different
product could come in between the two requests you are interested in
(so the global would be set for the wrong product) consider the case
where your app becomes popular enough to be distributed over multiple
instances of the server. In that case the two requests might go to
different servers so the global would not be setup for the second one.
Also consider that when using something like nginx to run your
production site that if it is not used for a while nginx may shutdown
the app and restart it when the next request comes in. Again the
global would not be set.
I suggest following Hassan's advice.
Colin
>
> On Friday, March 3, 2017 at 5:21:22 PM UTC-5, Colin Law wrote:
>>
>> On 3 March 2017 at 22:03, Joe Guerra <
JGu...@jginfosys.com> wrote:
>> > Ok, how do I deal with that?
>>
>> You have to recalculate the variable in each method that you need it.
>>
>> Colin
>