diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-05-02 17:25:05 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-05-02 17:25:05 +0200 |
commit | e3647ae226d19ed1401d4c617d35a68de1c4657a (patch) | |
tree | 725380f4123702dfc19d208d8cf90be10a7c2b32 /server/models | |
parent | a6e7400f6470a657059225807cc2853144088dbc (diff) | |
download | PeerTube-e3647ae226d19ed1401d4c617d35a68de1c4657a.tar.gz PeerTube-e3647ae226d19ed1401d4c617d35a68de1c4657a.tar.zst PeerTube-e3647ae226d19ed1401d4c617d35a68de1c4657a.zip |
Rename pool requests --> requests scheduler
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/requests.js (renamed from server/models/poolRequests.js) | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/server/models/poolRequests.js b/server/models/requests.js index 28093a94c..2152ae0e9 100644 --- a/server/models/poolRequests.js +++ b/server/models/requests.js | |||
@@ -6,16 +6,16 @@ const logger = require('../helpers/logger') | |||
6 | 6 | ||
7 | // --------------------------------------------------------------------------- | 7 | // --------------------------------------------------------------------------- |
8 | 8 | ||
9 | const poolRequestsSchema = mongoose.Schema({ | 9 | const requestsSchema = mongoose.Schema({ |
10 | type: String, | 10 | type: String, |
11 | id: String, // Special id to find duplicates (video created we want to remove...) | 11 | id: String, // Special id to find duplicates (video created we want to remove...) |
12 | request: mongoose.Schema.Types.Mixed | 12 | request: mongoose.Schema.Types.Mixed |
13 | }) | 13 | }) |
14 | const PoolRequestsDB = mongoose.model('poolRequests', poolRequestsSchema) | 14 | const RequestsDB = mongoose.model('requests', requestsSchema) |
15 | 15 | ||
16 | // --------------------------------------------------------------------------- | 16 | // --------------------------------------------------------------------------- |
17 | 17 | ||
18 | const PoolRequests = { | 18 | const Requests = { |
19 | create: create, | 19 | create: create, |
20 | findById: findById, | 20 | findById: findById, |
21 | list: list, | 21 | list: list, |
@@ -24,25 +24,25 @@ const PoolRequests = { | |||
24 | } | 24 | } |
25 | 25 | ||
26 | function create (id, type, request, callback) { | 26 | function create (id, type, request, callback) { |
27 | PoolRequestsDB.create({ id: id, type: type, request: request }, callback) | 27 | RequestsDB.create({ id: id, type: type, request: request }, callback) |
28 | } | 28 | } |
29 | 29 | ||
30 | function findById (id, callback) { | 30 | function findById (id, callback) { |
31 | PoolRequestsDB.findOne({ id: id }, callback) | 31 | RequestsDB.findOne({ id: id }, callback) |
32 | } | 32 | } |
33 | 33 | ||
34 | function list (callback) { | 34 | function list (callback) { |
35 | PoolRequestsDB.find({}, { _id: 1, type: 1, request: 1 }, callback) | 35 | RequestsDB.find({}, { _id: 1, type: 1, request: 1 }, callback) |
36 | } | 36 | } |
37 | 37 | ||
38 | function removeRequestById (id, callback) { | 38 | function removeRequestById (id, callback) { |
39 | PoolRequestsDB.remove({ id: id }, callback) | 39 | RequestsDB.remove({ id: id }, callback) |
40 | } | 40 | } |
41 | 41 | ||
42 | function removeRequests (ids) { | 42 | function removeRequests (ids) { |
43 | PoolRequestsDB.remove({ _id: { $in: ids } }, function (err) { | 43 | RequestsDB.remove({ _id: { $in: ids } }, function (err) { |
44 | if (err) { | 44 | if (err) { |
45 | logger.error('Cannot remove requests from the pool requests database.', { error: err }) | 45 | logger.error('Cannot remove requests from the requests database.', { error: err }) |
46 | return // Abort | 46 | return // Abort |
47 | } | 47 | } |
48 | 48 | ||
@@ -52,4 +52,4 @@ function removeRequests (ids) { | |||
52 | 52 | ||
53 | // --------------------------------------------------------------------------- | 53 | // --------------------------------------------------------------------------- |
54 | 54 | ||
55 | module.exports = PoolRequests | 55 | module.exports = Requests |