Added periodic memory logger.
This commit is contained in:
@@ -22,15 +22,15 @@ async function addAlert(alert, sessionUser) {
|
||||
.returning('id');
|
||||
|
||||
await Promise.all([
|
||||
alert.actors?.length > 0 && bulkInsert('alerts_actors', alert.actors.map(actorId => ({
|
||||
alert.actors?.length > 0 && bulkInsert('alerts_actors', alert.actors.map((actorId) => ({
|
||||
alert_id: alertId,
|
||||
actor_id: actorId,
|
||||
})), false),
|
||||
alert.tags?.length > 0 && bulkInsert('alerts_tags', alert.tags.map(tagId => ({
|
||||
alert.tags?.length > 0 && bulkInsert('alerts_tags', alert.tags.map((tagId) => ({
|
||||
alert_id: alertId,
|
||||
tag_id: tagId,
|
||||
})), false),
|
||||
alert.stashes?.length > 0 && bulkInsert('alerts_stashes', alert.stashes.map(stashId => ({
|
||||
alert.stashes?.length > 0 && bulkInsert('alerts_stashes', alert.stashes.map((stashId) => ({
|
||||
alert_id: alertId,
|
||||
stash_id: stashId,
|
||||
})), false),
|
||||
@@ -106,20 +106,20 @@ async function notify(scenes) {
|
||||
))))
|
||||
GROUP BY releases.id, users.id, alerts.id;
|
||||
`, {
|
||||
sceneIds: scenes.map(scene => scene.id),
|
||||
sceneIds: scenes.map((scene) => scene.id),
|
||||
});
|
||||
|
||||
const notifications = releases.rows
|
||||
.filter(alert => alert.notify)
|
||||
.map(notification => ({
|
||||
.filter((alert) => alert.notify)
|
||||
.map((notification) => ({
|
||||
user_id: notification.user_id,
|
||||
alert_id: notification.alert_id,
|
||||
scene_id: notification.scene_id,
|
||||
}));
|
||||
|
||||
const stashes = releases.rows
|
||||
.filter(release => release.stashes.length > 0)
|
||||
.flatMap(release => release.stashes.map(stash => ({
|
||||
.filter((release) => release.stashes.length > 0)
|
||||
.flatMap((release) => release.stashes.map((stash) => ({
|
||||
scene_id: release.scene_id,
|
||||
stash_id: stash,
|
||||
})));
|
||||
|
||||
Reference in New Issue
Block a user