update backend stuck/stall

This commit is contained in:
Matthias Hochmeister
2026-03-13 08:30:05 +01:00
parent 60488309ca
commit 243da302c7
9 changed files with 199 additions and 156 deletions

View File

@@ -1,4 +1,5 @@
import axios from 'axios';
import httpClient from '../config/httpClient';
import environment from '../config/environment';
import logger from '../utils/logger';
@@ -89,7 +90,7 @@ function buildHeaders(): Record<string, string> {
async function getBookSlugMap(): Promise<Map<number, string>> {
const { bookstack } = environment;
try {
const response = await axios.get(
const response = await httpClient.get(
`${bookstack.url}/api/books`,
{ params: { count: 500 }, headers: buildHeaders() },
);
@@ -108,7 +109,7 @@ async function getRecentPages(): Promise<BookStackPage[]> {
try {
const [response, bookSlugMap] = await Promise.all([
axios.get(
httpClient.get(
`${bookstack.url}/api/pages`,
{
params: { sort: '-updated_at', count: 20 },
@@ -141,7 +142,7 @@ async function searchPages(query: string): Promise<BookStackSearchResult[]> {
}
try {
const response = await axios.get(
const response = await httpClient.get(
`${bookstack.url}/api/search`,
{
params: { query, count: 50 },
@@ -197,7 +198,7 @@ async function getPageById(id: number): Promise<BookStackPageDetail> {
try {
const [response, bookSlugMap] = await Promise.all([
axios.get(
httpClient.get(
`${bookstack.url}/api/pages/${id}`,
{ headers: buildHeaders() },
),

View File

@@ -1,4 +1,5 @@
import axios from 'axios';
import httpClient from '../config/httpClient';
import environment from '../config/environment';
import logger from '../utils/logger';
@@ -82,7 +83,7 @@ async function initiateLoginFlow(): Promise<LoginFlowResult> {
}
try {
const response = await axios.post(`${baseUrl}/index.php/login/v2`);
const response = await httpClient.post(`${baseUrl}/index.php/login/v2`);
return {
loginUrl: response.data.login,
pollToken: response.data.poll.token,
@@ -105,7 +106,7 @@ async function pollLoginFlow(pollEndpoint: string, pollToken: string): Promise<L
throw new Error('pollEndpoint is not a valid service URL');
}
try {
const response = await axios.post(pollEndpoint, `token=${pollToken}`, {
const response = await httpClient.post(pollEndpoint, `token=${pollToken}`, {
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
});
return {
@@ -146,7 +147,7 @@ async function getAllConversations(loginName: string, appPassword: string): Prom
}
try {
const response = await axios.get(
const response = await httpClient.get(
`${baseUrl}/ocs/v2.php/apps/spreed/api/v4/room?format=json`,
{
headers: {
@@ -201,7 +202,7 @@ async function getMessages(token: string, loginName: string, appPassword: string
}
try {
const response = await axios.get(
const response = await httpClient.get(
`${baseUrl}/ocs/v2.php/apps/spreed/api/v1/chat/${encodeURIComponent(token)}`,
{
params: { lookIntoFuture: 0, limit: 50, setReadMarker: 0 },
@@ -250,7 +251,7 @@ async function sendMessage(token: string, message: string, loginName: string, ap
}
try {
await axios.post(
await httpClient.post(
`${baseUrl}/ocs/v2.php/apps/spreed/api/v1/chat/${encodeURIComponent(token)}`,
{ message },
{
@@ -287,7 +288,7 @@ async function markAsRead(token: string, loginName: string, appPassword: string)
}
try {
await axios.post(
await httpClient.post(
`${baseUrl}/ocs/v2.php/apps/spreed/api/v1/chat/${encodeURIComponent(token)}/read`,
{ lastReadMessage: null },
{
@@ -324,7 +325,7 @@ async function getConversations(loginName: string, appPassword: string): Promise
}
try {
const response = await axios.get(
const response = await httpClient.get(
`${baseUrl}/ocs/v2.php/apps/spreed/api/v4/room?format=json`,
{
headers: {

View File

@@ -1,4 +1,5 @@
import axios from 'axios';
import httpClient from '../config/httpClient';
import pool from '../config/database';
import environment from '../config/environment';
@@ -87,7 +88,7 @@ class ServiceMonitorService {
async pingService(url: string, headers?: Record<string, string>): Promise<PingResult> {
const start = Date.now();
try {
await axios.get(url, { timeout: 5000, headers });
await httpClient.get(url, { timeout: 5000, headers });
return {
name: '',
url,

View File

@@ -1,4 +1,5 @@
import axios from 'axios';
import httpClient from '../config/httpClient';
import environment from '../config/environment';
import logger from '../utils/logger';
@@ -71,7 +72,7 @@ async function getMyTasks(): Promise<VikunjaTask[]> {
}
try {
const response = await axios.get<VikunjaTask[]>(
const response = await httpClient.get<VikunjaTask[]>(
`${vikunja.url}/api/v1/tasks/all`,
{ headers: buildHeaders() },
);
@@ -104,7 +105,7 @@ async function getProjects(): Promise<VikunjaProject[]> {
}
try {
const response = await axios.get<VikunjaProject[]>(
const response = await httpClient.get<VikunjaProject[]>(
`${vikunja.url}/api/v1/projects`,
{ headers: buildHeaders() },
);
@@ -132,7 +133,7 @@ async function createTask(projectId: number, title: string, dueDate?: string): P
if (dueDate) {
body.due_date = dueDate;
}
const response = await axios.put<VikunjaTask>(
const response = await httpClient.put<VikunjaTask>(
`${vikunja.url}/api/v1/projects/${projectId}/tasks`,
body,
{ headers: buildHeaders() },