collect-system/apps/server/src/queue/general/general.service.ts

18 lines
532 B
TypeScript
Raw Normal View History

2024-08-02 19:48:38 +08:00
import axios, { AxiosInstance } from 'axios';
import { Injectable, Logger } from '@nestjs/common';
@Injectable()
export class GeneralService {
private axiosInstance: AxiosInstance;
private logger: Logger;
constructor() {
const PYTHON_ENDPOINT = process.env.PYTHON_URL || 'http://localhost:8000';
this.logger = new Logger(GeneralService.name);
this.axiosInstance = axios.create({
baseURL: PYTHON_ENDPOINT,
timeout: 120000, // 设置请求超时时间
});
}
}