Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Christian Merten
purescript-gargantext
Commits
b27e06f5
Verified
Commit
b27e06f5
authored
Jul 29, 2024
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[websockets] send job progress data directly in WS message
This avoids polling
parent
1b27aad9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
7 deletions
+6
-7
Types.purs
src/Gargantext/Components/Notifications/Types.purs
+5
-3
Progress.purs
src/Gargantext/Context/Progress.purs
+1
-4
No files found.
src/Gargantext/Components/Notifications/Types.purs
View file @
b27e06f5
...
...
@@ -82,7 +82,8 @@ instance JSON.WriteForeign WSRequest where
data Message =
-- TODO
-- MJobProgress GT.AsyncProgress
MJobProgress GT.AsyncTaskLog
-- MJobProgress GT.AsyncTaskLog
MJobProgress GT.AsyncProgress
| MEmpty
derive instance Generic Message _
instance JSON.ReadForeign Message where
...
...
@@ -92,8 +93,9 @@ instance JSON.ReadForeign Message where
"MJobProgress" -> do
-- TODO
-- { job_progress } <- JSON.readImpl f :: F.F { job_progress :: GT.AsyncProgress }
{ job_progress } <- JSON.readImpl f :: F.F { job_progress :: GT.AsyncTaskLog }
pure $ MJobProgress job_progress
-- { job_progress } <- JSON.readImpl f :: F.F { job_progress :: GT.AsyncTaskLog }
{ job_status } <- JSON.readImpl f :: F.F { job_status :: GT.AsyncProgress }
pure $ MJobProgress job_status
"MEmpty" -> do
pure MEmpty
s -> do F.fail $ F.ErrorAtProperty "type" $ F.ForeignError $ "unknown Message type: " <> s
...
...
src/Gargantext/Context/Progress.purs
View file @
b27e06f5
...
...
@@ -119,10 +119,7 @@ asyncProgressCpt = R2.hereComponent here "asyncProgress" hCpt where
let cb msg = do
-- here.log2 "callback! for job update" taskId
case msg of
NotificationsT.MJobProgress _jobProgress -> do
-- TODO With jobProgress we could avoid polling here
-- onJobProgress jobProgress
fetchJobProgress
NotificationsT.MJobProgress jobProgress -> launchAff_ $ onProgress jobProgress
NotificationsT.MEmpty -> fetchJobProgress
resetInterval intervalIdRef (Just defaultJobPollInterval) fetchJobProgress
...
...
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