On Tue, Mar 11, 2014 at 10:56 AM, Klaus Trainer <notifications@github.com>wrote:

> In src/couch_replicator/src/couch_replicator_httpc.erl:
>
> > +    true -> start_new_session(HttpDb, Worker)
> > +    end.
> > +
> > +
> > +need_new_session(#httpdb{credentials = undefined}) ->
> > +    false;
> > +
> > +need_new_session(#httpdb{credentials = Credentials}) ->
> > +    case ets:lookup(Credentials, cookie) of
> > +    [] ->
> > +        true;
> > +    [{cookie, _, UpdatedAt}] ->
> > +        %% As we don't know when the cookie will expire, we just decide
> > +        %% that we want a new session if the current one is older than
> > +        %% one minute.
> > +        OneMinute = 60 * 1000000, % microseconds
>
> @benoitc <https://github.com/benoitc> I'm sorry, I don't see how TS - Nowcould relate to the expiry time that's configured on the remote server.
>
>
> Well when you get the expires times in the cookie and compare it to the
current hour on your machine you know the delay in which the cookie is
supposed to expire. So either you check against the cookie expires times
each time, or set a timer to remove it from the ets which will trigger the
401 the next time ou try to authenticate. In other cases you will have this
401 anyway.