<p dir="auto">Follow up for <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2377473515" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/operations/issues/1107" data-hovercard-type="issue" data-hovercard-url="/openstreetmap/operations/issues/1107/hovercard" href="https://github.com/openstreetmap/operations/issues/1107">openstreetmap/operations#1107</a></p>
<p dir="auto">The goal of this PR is to set the <code class="notranslate">expiry_after</code> value for unauthenticated users to a fairly low value (read: a few hours). This way, memcached entries are no longer created with a TTL of 0 (unlimited).</p>
<p dir="auto">Previously, logged one user sessions were evicted first, because their TTL is set to 30 days in session_persistence.rb / session_methods.rb. As a result, a number of users reported that they had to repeatedly sign in to osm.org, since their session was gone.</p>
<p dir="auto">The chosen approach is based on what Gitlab is doing in <a href="https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/middleware/unauthenticated_session_expiry.rb" rel="nofollow">https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/middleware/unauthenticated_session_expiry.rb</a>, with the difference that I replaced redis by memcached, and warden by a simple logged on user check.</p>
<p dir="auto">It still needs some tests. However, I'm not sure what the best way would be.</p>
<hr>
<p dir="auto">Prometheus stats: <a href="https://prometheus.openstreetmap.org/d/l4zgNUdMz/memcached?orgId=1&refresh=1m&var-instance=spike-06&var-instance=spike-07&var-instance=spike-08&from=now-30d&to=now" rel="nofollow">https://prometheus.openstreetmap.org/d/l4zgNUdMz/memcached?orgId=1&refresh=1m&var-instance=spike-06&var-instance=spike-07&var-instance=spike-08&from=now-30d&to=now</a></p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/openstreetmap/openstreetmap-website/pull/5270'>https://github.com/openstreetmap/openstreetmap-website/pull/5270</a></p>

<h4>Commit Summary</h4>
<ul>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5270/commits/c3d8be0923dfe67a6ab0455dbcc8b1eb5de1056b" class="commit-link">c3d8be0</a>  Unauthenticated session expiry</li>
</ul>

<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5270/files">2 files</a>)</p>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5270/files#diff-bb2a4b5fcffb49c9f95d0f839ba62c674a05fe17ac90798a38178a8a3a3b528b">config/initializers/session_store.rb</a>
    (43)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5270/files#diff-e769bbb8c1ba3711c5403b424ed9c218ffafba7f1890ee394717196f28ff4540">config/settings.yml</a>
    (1)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/5270.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/5270.patch</a></li>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/5270.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/5270.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5270">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLNNEEYXYP5F5K2YTYTZ3725JAVCNFSM6AAAAABQEJHF4GVHI2DSMVQWIX3LMV43ASLTON2WKOZSGU4TKMZYGI2DSNI">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLOGZPZAYFWSFGEFZVLZ3725JA5CNFSM6AAAAABQEJHF4GWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHJVMTE34.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/5270</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/5270",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/5270",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>