On Mar 11, 2014 10:20 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
>
> Yes, that's possible, but what advantage would it get us? I had
previously implemented it, but then threw it away again. One disadvantage
of that is that it makes us rely on clocks being synchronized, which is an
assumption we probably like to avoid here.
>
> As of now, we unfortunately don't have any knowledge about the expiry
time of a cookie here (there's only have the timestamp). Choosing one
minute seems like a good compromise to me, as it's unlikely that people
will configuring a session timeout below that. However, it might be good to
consequently limit the session timeout to a minimum of one minute and
document it appropriately.
>

it would allows us to reduce the number of calls which is already pretty
high. what for example when the cookie never expires?

and well TS - Now = expiry time.

- benoit

> --
> Reply to this email directly or view it on GitHub.