prevent huge data amounts, separate sources
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = (get_db) => ({
|
||||
get_all (app_id) {
|
||||
get_all (app_id, limit = 100, offset = 0) {
|
||||
const knex = get_db ();
|
||||
return knex.select (
|
||||
'id',
|
||||
@ -17,7 +17,10 @@ module.exports = (get_db) => ({
|
||||
'timestamp'
|
||||
)
|
||||
.from ('log')
|
||||
.where ({ app_id });
|
||||
.where ({ app_id })
|
||||
.orderBy ('timestamp')
|
||||
.limit (Math.min (limit, 10000))
|
||||
.offset (offset);
|
||||
},
|
||||
insert (app_id, message, data = '{}', timestamp = (new Date)) {
|
||||
const knex = get_db ();
|
||||
|
Reference in New Issue
Block a user