feat: implement billing, usage tracking, and administrative geocoding features in API with infrastructure updates
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
var IndexRefreshService_1;
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IndexRefreshService = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
const schedule_1 = require("@nestjs/schedule");
|
||||
const typeorm_1 = require("@nestjs/typeorm");
|
||||
const typeorm_2 = require("typeorm");
|
||||
const osm_point_with_area_entity_1 = require("./entities/osm-point-with-area.entity");
|
||||
let IndexRefreshService = IndexRefreshService_1 = class IndexRefreshService {
|
||||
repo;
|
||||
logger = new common_1.Logger(IndexRefreshService_1.name);
|
||||
constructor(repo) {
|
||||
this.repo = repo;
|
||||
}
|
||||
async handleCron() {
|
||||
this.logger.log('Starting background refresh for unified_search_index...');
|
||||
try {
|
||||
await this.repo.query('REFRESH MATERIALIZED VIEW CONCURRENTLY unified_search_index;');
|
||||
this.logger.log('Successfully refreshed unified_search_index.');
|
||||
}
|
||||
catch (error) {
|
||||
this.logger.error('Failed to refresh unified_search_index', error);
|
||||
try {
|
||||
this.logger.log('Attempting standard refresh (blocking)...');
|
||||
await this.repo.query('REFRESH MATERIALIZED VIEW unified_search_index;');
|
||||
this.logger.log('Successfully refreshed unified_search_index (standard).');
|
||||
}
|
||||
catch (fallbackError) {
|
||||
this.logger.error('Fallback standard refresh also failed', fallbackError);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.IndexRefreshService = IndexRefreshService;
|
||||
__decorate([
|
||||
(0, schedule_1.Cron)(schedule_1.CronExpression.EVERY_5_MINUTES),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", []),
|
||||
__metadata("design:returntype", Promise)
|
||||
], IndexRefreshService.prototype, "handleCron", null);
|
||||
exports.IndexRefreshService = IndexRefreshService = IndexRefreshService_1 = __decorate([
|
||||
(0, common_1.Injectable)(),
|
||||
__param(0, (0, typeorm_1.InjectRepository)(osm_point_with_area_entity_1.OsmPointWithArea)),
|
||||
__metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
|
||||
], IndexRefreshService);
|
||||
//# sourceMappingURL=index-refresh.service.js.map
|
||||
Reference in New Issue
Block a user