1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

Server: add requests stats endpoint

This commit is contained in:
Chocobozzz 2016-09-19 21:33:46 +02:00
parent 2e92c10b6c
commit d3cd34be2f
6 changed files with 199 additions and 7 deletions

View file

@ -19,14 +19,15 @@ let timer = null
const RequestSchema = mongoose.Schema({
request: mongoose.Schema.Types.Mixed,
to: [ { type: mongoose.Schema.Types.ObjectId, ref: 'users' } ]
to: [ { type: mongoose.Schema.Types.ObjectId, ref: 'Pod' } ]
})
RequestSchema.statics = {
activate,
deactivate,
flush,
forceSend
forceSend,
list
}
RequestSchema.pre('save', function (next) {
@ -53,7 +54,7 @@ mongoose.model('Request', RequestSchema)
function activate () {
logger.info('Requests scheduler activated.')
timer = setInterval(makeRequests.bind(this), constants.INTERVAL)
timer = setInterval(makeRequests.bind(this), constants.REQUESTS_INTERVAL)
}
function deactivate () {
@ -72,6 +73,10 @@ function forceSend () {
makeRequests.call(this)
}
function list (callback) {
this.find({ }, callback)
}
// ---------------------------------------------------------------------------
// Make a requests to friends of a certain type