pruned server logs
This commit is contained in:
parent
0289409c9c
commit
8cfb45944c
@ -175,10 +175,7 @@ app.get('/assets/download/:id', async (req, res) => {
|
||||
|
||||
file_stream.on('end', async () => {
|
||||
try {
|
||||
const err = await storage.forceDelete(id);
|
||||
if (!err) {
|
||||
log.info('Deleted:', id);
|
||||
}
|
||||
await storage.forceDelete(id);
|
||||
} catch (e) {
|
||||
log.info('DeleteError:', id);
|
||||
}
|
||||
@ -208,7 +205,6 @@ app.post('/delete/:id', async (req, res) => {
|
||||
try {
|
||||
const err = await storage.delete(id, delete_token);
|
||||
if (!err) {
|
||||
log.info('Deleted:', id);
|
||||
res.sendStatus(200);
|
||||
}
|
||||
} catch (e) {
|
||||
@ -238,12 +234,9 @@ app.post('/upload', (req, res, next) => {
|
||||
}
|
||||
|
||||
meta.delete = crypto.randomBytes(10).toString('hex');
|
||||
log.info('meta', meta);
|
||||
req.pipe(req.busboy);
|
||||
|
||||
req.busboy.on('file', async (fieldname, file, filename) => {
|
||||
log.info('Uploading:', newId);
|
||||
|
||||
try {
|
||||
await storage.set(newId, file, filename, meta);
|
||||
|
||||
@ -264,10 +257,7 @@ app.post('/upload', (req, res, next) => {
|
||||
|
||||
req.on('close', async err => {
|
||||
try {
|
||||
const err = await storage.forceDelete(newId);
|
||||
if (!err) {
|
||||
log.info('Deleted:', newId);
|
||||
}
|
||||
await storage.forceDelete(newId);
|
||||
} catch (e) {
|
||||
log.info('DeleteError:', newId);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ const redis_client = redis.createClient({
|
||||
});
|
||||
|
||||
redis_client.on('error', err => {
|
||||
log.info('Redis:', err);
|
||||
log.error('Redis:', err);
|
||||
});
|
||||
|
||||
if (conf.s3_bucket) {
|
||||
@ -155,6 +155,7 @@ function localDelete(id, delete_token) {
|
||||
reject();
|
||||
} else {
|
||||
redis_client.del(id);
|
||||
log.info('Deleted:', id);
|
||||
resolve(fs.unlinkSync(path.join(__dirname, '../static', id)));
|
||||
}
|
||||
});
|
||||
@ -201,7 +202,6 @@ function awsGet(id) {
|
||||
try {
|
||||
return s3.getObject(params).createReadStream();
|
||||
} catch (err) {
|
||||
log.info('GetFailed', 'Get Object from s3 failed.');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -222,7 +222,6 @@ function awsSet(newId, file, filename, meta) {
|
||||
() => {
|
||||
redis_client.hmset(newId, meta);
|
||||
redis_client.expire(newId, conf.expire_seconds);
|
||||
log.info('awsUploadFinish', 'Upload Finished of ' + filename);
|
||||
},
|
||||
err => {
|
||||
if (hitLimit) {
|
||||
@ -263,7 +262,7 @@ function awsForceDelete(id) {
|
||||
|
||||
s3.deleteObject(params, function(err, _data) {
|
||||
redis_client.del(id);
|
||||
err ? reject(err) : resolve(err);
|
||||
err ? reject(err) : resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user