Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[inferno-vc-server] Use unbounded-delays for threadDelay so it doesn't overflow on armv7l #133

Merged
merged 2 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions inferno-vc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Revision History for inferno-vc
*Note*: we use https://pvp.haskell.org/ (MAJOR.MAJOR.MINOR.PATCH)

## 0.3.7.1 -- 2024-09-23
* Fix overflowing threadDelay on armv7l

## 0.3.7.0 -- 2024-08-19
* Cached client now serializes requests to server for the same script ids in
order to avoid DOSing the server when the same script is requested many times
Expand Down
3 changes: 2 additions & 1 deletion inferno-vc/inferno-vc.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: >=1.10
name: inferno-vc
version: 0.3.7.0
version: 0.3.7.1
synopsis: Version control server for Inferno
description: A version control server for Inferno scripts
category: DSL,Scripting
Expand Down Expand Up @@ -68,6 +68,7 @@ library
, hspec
, QuickCheck
, stm
, unbounded-delays

default-language: Haskell2010
default-extensions:
Expand Down
5 changes: 3 additions & 2 deletions inferno-vc/src/Inferno/VersionControl/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE NumericUnderscores #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
Expand All @@ -17,8 +18,8 @@ module Inferno.VersionControl.Server
)
where

import Control.Concurrent (threadDelay)
import Control.Concurrent.Async (link, withAsync)
import Control.Concurrent.Thread.Delay (delay)
import Control.Exception (Exception)
import Control.Lens (to, (^.))
import Control.Monad (forM, forever)
Expand Down Expand Up @@ -179,7 +180,7 @@ runServerConfig middleware withEnv runOp serverConfig = do
Right _ -> pure ()
print ("running..." :: String)
-- Cleanup stale autosave scripts in a separate thread every hour:
withLinkedAsync_ (forever $ threadDelay 3600000000 >> cleanup) $
withLinkedAsync_ (forever $ delay 3_600_000_000 >> cleanup) $
-- And run the server:
runSettings (setPort port $ setHost host settingsWithTimeout) $
ungzipRequest $
Expand Down
Loading