Bug fix, no lock on actors variable, enabling Pleroma statistics
This commit is contained in:
parent
e6937f733e
commit
f041f0443e
@ -263,7 +263,9 @@ func check_actor(uri string) *ActorJson {
|
|||||||
logWarn("Unable to unmarshal body from ", uri)
|
logWarn("Unable to unmarshal body from ", uri)
|
||||||
return nil // Unable to unmarshal body of message
|
return nil // Unable to unmarshal body of message
|
||||||
}
|
}
|
||||||
|
o.Recentactors.Mu.Lock()
|
||||||
o.Recentactors.Add(uri, actorjson)
|
o.Recentactors.Add(uri, actorjson)
|
||||||
|
o.Recentactors.Mu.Unlock()
|
||||||
|
|
||||||
var bot bool
|
var bot bool
|
||||||
if actorjson.Type == "Service" {
|
if actorjson.Type == "Service" {
|
||||||
@ -278,6 +280,8 @@ func check_actor(uri string) *ActorJson {
|
|||||||
return nil // Unable to insert actor
|
return nil // Unable to insert actor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
o.Recentactors.Mu.Lock()
|
||||||
o.Recentactors.Add(uri, actorjson)
|
o.Recentactors.Add(uri, actorjson)
|
||||||
|
o.Recentactors.Mu.Unlock()
|
||||||
return actorjson // Successful
|
return actorjson // Successful
|
||||||
}
|
}
|
||||||
|
@ -155,12 +155,12 @@ func StreamPleroma(endpoint string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ri_mutex.Lock()
|
ri_mutex.Lock()
|
||||||
// m := runninginstances[endpoint]
|
m := runninginstances[endpoint]
|
||||||
// m.Status = shared.RUNNING
|
m.Status = shared.RUNNING
|
||||||
// m.LastRun = "Streaming"
|
m.LastRun = "Streaming"
|
||||||
// runninginstances[endpoint] = m
|
runninginstances[endpoint] = m
|
||||||
// ri_mutex.Unlock()
|
ri_mutex.Unlock()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
logDebug("Starting Pleroma Stream loop for ", endpoint)
|
logDebug("Starting Pleroma Stream loop for ", endpoint)
|
||||||
@ -264,7 +264,7 @@ func StreamMastodon(endpoint string, o *shared.RunningInstance) {
|
|||||||
s := bufio.NewScanner(resp.Body)
|
s := bufio.NewScanner(resp.Body)
|
||||||
var name string
|
var name string
|
||||||
for s.Scan() {
|
for s.Scan() {
|
||||||
logDebug("Ending Mastodon stream loop for ", endpoint)
|
logDebug("Starting Mastodon stream loop for ", endpoint)
|
||||||
line := s.Text()
|
line := s.Text()
|
||||||
token := strings.SplitN(line, ":", 2)
|
token := strings.SplitN(line, ":", 2)
|
||||||
var newactivity shared.ReportActivity
|
var newactivity shared.ReportActivity
|
||||||
|
Loading…
x
Reference in New Issue
Block a user