Юра
Друзья, у меня такой вопрос! Куда отправляются данные из res.status.send в промисах монгуса?
const id = req.params.id
console.log(`ID: ${id}`)
Laureate.findOneAndDelete({id})
.then(laureate => {
return !laureate
? res.status(404).send()
: res.status(200).send('Laureate successfully deleted')
})
.catch((e) => res.status(400).send(e))Вот например как то, что в res.status.send вывести на экран в виде, допустим, алерта?
Алимжан
<--- Last few GCs --->
[50:0x4428100] 307957 ms: Scavenge 1390.7 (1424.3) -> 1390.0 (1424.3) MB, 2.0 / 0.0 ms (average mu = 0.082, current mu = 0.027) allocation failure
[50:0x4428100] 307961 ms: Scavenge 1390.8 (1424.3) -> 1390.1 (1424.3) MB, 1.8 / 0.0 ms (average mu = 0.082, current mu = 0.027) allocation failure
[50:0x4428100] 307966 ms: Scavenge 1391.0 (1424.3) -> 1390.3 (1424.8) MB, 1.9 / 0.0 ms (average mu = 0.082, current mu = 0.027) allocation failure
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x12b1f2d5c01d]
Security context: 0x2749caf1e681 <JSObject>
1: /* anonymous */ [0x38bf434ebdd9] [/usr/app/node_modules/postgres-array/index.js:~3] [pc=0x12b1f3be6f44](this=0x259de161a171 <Object map = 0x2b0fc9ba0c89>,source=0x3da420229291 <String[9]: {1180878}>,transform=0x3da4202294c9 <JSFunction nullAllowed (sfi = 0x32c222c8ae91)>)
2: parseIntegerArray [0x259de1621561] [/usr/app/node_modules/pg-types/lib/te...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x8d1bc0 node::Abort() [node]
2: 0x8d1c0c [node]
3: 0xb00bae v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
4: 0xb00de4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
5: 0xeee2b2 [node]
6: 0xeee3b8 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [node]
7: 0xefa4e2 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]
8: 0xefae14 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
9: 0xefda81 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [node]
10: 0xec6fa4 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [node]
11: 0x11660ce v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [node]
12: 0x12b1f2d5c01d
Aborted (core dumped)
error Command failed with exit code 134.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Алимжан
{"level":20,"time":1548340664874,"msg":"Running query","pid":50,"hostname":"okauto-worker-987747c77-jddzn","namespace":"models:penalties","method":"select","sql":"select \"penalties\".* from \"penalties\" where 1 = ?","bindings":[0],"v":1}
{"level":20,"time":1548340664874,"msg":"Running query","pid":50,"hostname":"okauto-worker-987747c77-jddzn","namespace":"models:penalties","method":"select","sql":"select \"penalties\".* from \"penalties\" where \"penalties\".\"id\" in (?)","bindings":["5000000002678010"],"v":1}
{"level":30,"time":1548340664882,"msg":"Job completed","pid":50,"hostname":"okauto-worker-987747c77-jddzn","namespace":"queues:penalty-checks:run-penalty-check","jobId":"cron:bin:951040000801:1548340562605","v":1}
{"level":30,"time":1548340664882,"msg":"Job completed","pid":50,"hostname":"okauto-worker-987747c77-jddzn","namespace":"queues:penalty-checks:run-penalty-check","jobId":"cron:bin:951040000306:1548340545024","v":1}
<--- Last few GCs --->
[50:0x3ecd100] 61733 ms: Scavenge 1391.9 (1424.3) -> 1391.2 (1424.8) MB, 2.3 / 0.0 ms (average mu = 0.149, current mu = 0.098) allocation failure
[50:0x3ecd100] 62952 ms: Mark-sweep 1392.0 (1424.8) -> 1391.0 (1424.3) MB, 1217.2 / 0.0 ms (average mu = 0.132, current mu = 0.108) allocation failure scavenge might not succeed
[50:0x3ecd100] 62970 ms: Scavenge 1391.8 (1424.3) -> 1391.1 (1424.8) MB, 15.5 / 0.0 ms (average mu = 0.132, current mu = 0.108) allocation failure
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0xd1a9335c01d]
Security context: 0x3a3bf0a1e681 <JSObject>
1: exec [0x3a3bf0a0cf91](this=0x1d084923d0e9 <JSRegExp <String[35]: ([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?>>,0x2cf293526e69 <String[15]: 13:59:43.482+00>)
2: parseDate [0x2c6e405c5c09] [/usr/app/node_modules/postgres-date/index.js:~9] [pc=0xd1a93aa54c2](this=0x076df5840e59 <JSArray[14]>,isoDate=0x2cf293526d11 <String[26]: 2019-01-14 13:59:43.482+00>)
...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x8d1bc0 node::Abort() [node]
2: 0x8d1c0c [node]
3: 0xb00bae v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
4: 0xb00de4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
5: 0xeee2b2 [node]
6: 0xeee3b8 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [node]
7: 0xefa4e2 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]
8: 0xefae14 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
9: 0xefda81 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [node]
10: 0xec6fa4 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [node]
11: 0x11660ce v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [node]
12: 0xd1a9335c01d
Aborted (core dumped)
error Command failed with exit code 134.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.