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