mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 10:19:35 +02:00
First version with PostgreSQL
This commit is contained in:
parent
108626609e
commit
feb4bdfd9b
68 changed files with 1171 additions and 730 deletions
|
@ -1,15 +1,13 @@
|
|||
'use strict'
|
||||
|
||||
const express = require('express')
|
||||
const mongoose = require('mongoose')
|
||||
|
||||
const constants = require('../../initializers/constants')
|
||||
const db = require('../../initializers/database')
|
||||
const middlewares = require('../../middlewares')
|
||||
const admin = middlewares.admin
|
||||
const oAuth = middlewares.oauth
|
||||
|
||||
const Request = mongoose.model('Request')
|
||||
|
||||
const router = express.Router()
|
||||
|
||||
router.get('/stats',
|
||||
|
@ -25,13 +23,13 @@ module.exports = router
|
|||
// ---------------------------------------------------------------------------
|
||||
|
||||
function getStatsRequests (req, res, next) {
|
||||
Request.list(function (err, requests) {
|
||||
db.Request.countTotalRequests(function (err, totalRequests) {
|
||||
if (err) return next(err)
|
||||
|
||||
return res.json({
|
||||
requests: requests,
|
||||
totalRequests: totalRequests,
|
||||
maxRequestsInParallel: constants.REQUESTS_IN_PARALLEL,
|
||||
remainingMilliSeconds: Request.remainingMilliSeconds(),
|
||||
remainingMilliSeconds: db.Request.remainingMilliSeconds(),
|
||||
milliSecondsInterval: constants.REQUESTS_INTERVAL
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue