Skip to content

Commit

Permalink
Merge pull request #1427 from Badgerati/Issue-1408
Browse files Browse the repository at this point in the history
Fixes "collection modified" error when cleaning up sessions
  • Loading branch information
Badgerati authored Oct 21, 2024
2 parents 860aa58 + d2d6a00 commit 79ec468
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Private/Sessions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ function Set-PodeSessionInMemClearDown {

# remove sessions that have expired, or where the parent is gone
$now = [DateTime]::UtcNow
foreach ($key in $store.Memory.Keys) {
foreach ($key in $store.Memory.Keys.Clone()) {
# expired
if ($store.Memory[$key].Expiry -lt $now) {
$null = $store.Memory.Remove($key)
Expand Down

0 comments on commit 79ec468

Please sign in to comment.