about summary refs log tree commit diff
path: root/MatrixUtils.Web/Pages/HSAdmin/Synapse/BackgroundJobs.razor
blob: d855cba6dacf04405b143867b87d040c1e0de964 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
@page "/HSAdmin/Synapse/BackgroundJobs"
@using ArcaneLibs.Extensions
@using LibMatrix.Homeservers.ImplementationDetails.Synapse.Models.Responses

<h3>Homeserver Administration - Background jobs</h3>
<pre>@BackgroundJobStatus?.ToJson(ignoreNull: true)</pre>

@code {
    private AuthenticatedHomeserverSynapse? Homeserver { get; set; }
    private SynapseAdminBackgroundUpdateStatusResponse? BackgroundJobStatus { get; set; }

    protected override async Task OnInitializedAsync() {
        var hs = await sessionStore.GetCurrentHomeserver(navigateOnFailure: true) as AuthenticatedHomeserverSynapse;
        if (hs is null) return;
        Homeserver = hs;

        while (true) {
            try {
                BackgroundJobStatus = await hs.Admin.GetBackgroundUpdatesStatusAsync();
                StateHasChanged();
                await Task.Delay(1000);
            }
            catch (Exception ex) {
                Console.WriteLine(ex);
            }
        }
    }

}