Fix cache bugs and player list display bugs.
Some checks are pending
ci/woodpecker/push/build Pipeline is pending
Some checks are pending
ci/woodpecker/push/build Pipeline is pending
This commit is contained in:
parent
ac912af1d9
commit
c209cf05ba
@ -206,18 +206,26 @@
|
|||||||
<p>
|
<p>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="centered">Player List{{ if .Queried.PlayerCount }} ({{ .Queried.PlayerCount }}) {{ end }}</th>
|
<th>Player List{{ if .Queried.PlayerCount }} ({{ .Queried.PlayerCount }}) {{ end }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="centered"><a href="{{ .ToggleQuery "players" }}" title="Collapse Player List.">Collapse Player List</a></td>
|
<td class="centered"><a href="{{ .ToggleQuery "players" }}" title="Collapse Player List.">Collapse Player List</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{{ if gt (len (.Queried.GetPlayers .Data.ShowAnonymousPlayers)) 0 }}
|
{{ if gt (len (.Queried.GetPlayers .Data.ShowAnonymousPlayers)) 0 }}
|
||||||
|
{{ if .Data.ShowAnonymousPlayers }}
|
||||||
{{ range .Queried.Players }}
|
{{ range .Queried.Players }}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ if or .Data.ShowAnonymousPlayers (ne . "Anonymous Player") }}{{ . }}{{ end }}</td>
|
<td>{{ . }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
|
{{ range .Queried.Players }}
|
||||||
|
<tr>
|
||||||
|
<td>{{ if ne . "Anonymous Player" }}{{ . }}{{ end }}</td>
|
||||||
|
</tr>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ else }}
|
||||||
<tr>
|
<tr>
|
||||||
<td>No Detectable Players.</td>
|
<td>No Detectable Players.</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -232,7 +240,7 @@
|
|||||||
<p>
|
<p>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="centered">Mod List ({{ .Queried.PlayerCount }})</th>
|
<th>Mod List ({{ .Queried.PlayerCount }})</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="centered"><a href="{{ .ToggleQuery "mods" }}" title="Collapse Mod List.">Collapse Mod List</a></td>
|
<td class="centered"><a href="{{ .ToggleQuery "mods" }}" title="Collapse Mod List.">Collapse Mod List</a></td>
|
||||||
|
@ -42,6 +42,7 @@ type Page struct {
|
|||||||
LastModifiedTemplate time.Time
|
LastModifiedTemplate time.Time
|
||||||
CachedMC *MC
|
CachedMC *MC
|
||||||
CollectedMCExpiry time.Time
|
CollectedMCExpiry time.Time
|
||||||
|
LastModifiedMC time.Time
|
||||||
CacheMCMutex *sync.Mutex
|
CacheMCMutex *sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,10 +51,16 @@ func (p *Page) GetPath() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *Page) GetLastModified() time.Time {
|
func (p *Page) GetLastModified() time.Time {
|
||||||
|
var toTest time.Time
|
||||||
if p.LastModifiedData.After(p.LastModifiedTemplate) {
|
if p.LastModifiedData.After(p.LastModifiedTemplate) {
|
||||||
return p.LastModifiedData
|
toTest = p.LastModifiedData
|
||||||
} else {
|
} else {
|
||||||
return p.LastModifiedTemplate
|
toTest = p.LastModifiedTemplate
|
||||||
|
}
|
||||||
|
if p.LastModifiedMC.After(toTest) {
|
||||||
|
return p.LastModifiedMC
|
||||||
|
} else {
|
||||||
|
return toTest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +121,8 @@ func (p *Page) GetMC(theData *DataYaml, theMarshal *Marshal) MC {
|
|||||||
theMarshal.Online = false
|
theMarshal.Online = false
|
||||||
p.CachedMC = nil
|
p.CachedMC = nil
|
||||||
}
|
}
|
||||||
p.CollectedMCExpiry = time.Now().Add(theData.MCQueryInterval)
|
p.LastModifiedMC = time.Now()
|
||||||
|
p.CollectedMCExpiry = p.LastModifiedMC.Add(theData.MCQueryInterval)
|
||||||
} else {
|
} else {
|
||||||
if p.CachedMC == nil {
|
if p.CachedMC == nil {
|
||||||
theMC = MC{}
|
theMC = MC{}
|
||||||
|
Loading…
Reference in New Issue
Block a user