Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
195
Issues
195
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
2467fb40
Commit
2467fb40
authored
May 26, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[OPTIM][FIX] serialise/deserialise without encode/decode json
parent
84e3f3f0
Pipeline
#861
canceled with stage
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
Settings.hs
src/Gargantext/API/Admin/Settings.hs
+5
-5
No files found.
src/Gargantext/API/Admin/Settings.hs
View file @
2467fb40
...
@@ -26,14 +26,13 @@ TODO-SECURITY: Critical
...
@@ -26,14 +26,13 @@ TODO-SECURITY: Critical
module
Gargantext.API.Admin.Settings
module
Gargantext.API.Admin.Settings
where
where
import
Codec.Serialise
(
Serialise
(),
serialise
)
import
Codec.Serialise
(
Serialise
(),
serialise
,
deserialise
)
import
Control.Concurrent
import
Control.Concurrent
import
Control.Debounce
(
mkDebounce
,
defaultDebounceSettings
,
debounceFreq
,
debounceAction
)
import
Control.Debounce
(
mkDebounce
,
defaultDebounceSettings
,
debounceFreq
,
debounceAction
)
import
Control.Exception
(
finally
)
import
Control.Exception
(
finally
)
import
Control.Lens
import
Control.Lens
import
Control.Monad.Logger
import
Control.Monad.Logger
import
Control.Monad.Reader
import
Control.Monad.Reader
import
Data.Aeson
hiding
(
encode
)
import
Data.ByteString
(
ByteString
)
import
Data.ByteString
(
ByteString
)
import
Data.Either
(
either
)
import
Data.Either
(
either
)
import
Data.Maybe
(
fromMaybe
)
import
Data.Maybe
(
fromMaybe
)
...
@@ -191,7 +190,7 @@ repoSnapshot = repoDir <> "/repo.json"
...
@@ -191,7 +190,7 @@ repoSnapshot = repoDir <> "/repo.json"
repoSaverAction
::
Serialise
a
=>
a
->
IO
()
repoSaverAction
::
Serialise
a
=>
a
->
IO
()
repoSaverAction
a
=
do
repoSaverAction
a
=
do
withTempFile
"repos"
"tmp-repo.json"
$
\
fp
h
->
do
withTempFile
"repos"
"tmp-repo.json"
$
\
fp
h
->
do
--
printDebug "repoSaverAction" fp
printDebug
"repoSaverAction"
fp
L
.
hPut
h
$
serialise
a
L
.
hPut
h
$
serialise
a
hClose
h
hClose
h
renameFile
fp
repoSnapshot
renameFile
fp
repoSnapshot
...
@@ -230,8 +229,9 @@ readRepoEnv = do
...
@@ -230,8 +229,9 @@ readRepoEnv = do
mvar
<-
newMVar
=<<
mvar
<-
newMVar
=<<
if
repoExists
if
repoExists
then
do
then
do
e_repo
<-
eitherDecodeFileStrict
repoSnapshot
-- e_repo <- eitherDecodeStrict <$> deserialise <$> L.readFile repoSnapshot
repo
<-
either
fail
pure
e_repo
repo
<-
deserialise
<$>
L
.
readFile
repoSnapshot
-- repo <- either fail pure e_repo
let
archive
=
repoSnapshot
<>
".v"
<>
show
(
repo
^.
r_version
)
let
archive
=
repoSnapshot
<>
".v"
<>
show
(
repo
^.
r_version
)
copyFile
repoSnapshot
archive
copyFile
repoSnapshot
archive
pure
repo
pure
repo
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment