Skip to content

Commit 0e4d30d

Browse files
committed
web connect/update are goroutines
1 parent 43efbb0 commit 0e4d30d

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

internal/nrtm4serve/webapi.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@ func (api WebAPI) SaveProperties(source, label string, props persist.SourcePrope
6969

7070
// Connect connects a new source to the repo
7171
func (api WebAPI) Connect(url, label string) (string, error) {
72-
err := api.Processor.Connect(url, label)
73-
if err != nil {
74-
service.UserLogger.Error("Connect failed", "url", url, "label", label, "error", err)
75-
}
76-
return "OK", wrapErr(err)
72+
go func() {
73+
err := api.Processor.Connect(url, label)
74+
if err != nil {
75+
service.UserLogger.Error("Connect failed", "url", url, "label", label, "error", err)
76+
}
77+
}()
78+
return "OK", nil
7779
}
7880

7981
// Update updates a source to the latest version
@@ -96,7 +98,8 @@ func (api WebAPI) Update(src, label string) (persist.NRTMSourceDetails, error) {
9698

9799
// RemoveSource removes a source from the repo
98100
func (api WebAPI) RemoveSource(src, label string) (string, error) {
99-
return "OK", wrapErr(api.Processor.RemoveSource(src, label))
101+
go api.Processor.RemoveSource(src, label)
102+
return "OK", nil
100103
}
101104

102105
func wrapErr(err error) error {

web/assets/styles.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
.loglevel {
33
border-radius: 1em;
44
background-color: grey;
5+
color: black;
56
height: 1.4em;
67
width: 1.4em;
78
display: inline-block;

0 commit comments

Comments
 (0)