Commit 31bfae78 authored by Nico Baruna Putra's avatar Nico Baruna Putra

edit read file method

parent d9c16e52
......@@ -2492,3 +2492,42 @@ TypeError: Cannot read property 'map' of null
TypeError: Cannot read property 'map' of null
at Object.flush (/var/www/webapps/caraka/source/dist/src/utils/CacheHelper.js:216:27)
at <anonymous>
TypeError: Cannot read property 'map' of null
at Object.flush (/var/www/webapps/caraka/source/dist/src/utils/CacheHelper.js:216:27)
at <anonymous>
(node:23395) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'map' of null
at Object.flush (/var/www/webapps/caraka/source/dist/src/utils/CacheHelper.js:216:27)
at <anonymous>
(node:23395) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 314)
(node:23395) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:23395) UnhandledPromiseRejectionWarning: SequelizeConnectionAcquireTimeoutError: Operation timeout
at pool.acquire.catch.error (/var/www/webapps/caraka/source/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:289:52)
at <anonymous>
(node:23395) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 543)
(node:23395) UnhandledPromiseRejectionWarning: Error: WHERE parameter "id" has invalid "undefined" value
at PostgresQueryGenerator.whereItemQuery (/var/www/webapps/caraka/source/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2184:13)
at Utils.getComplexKeys.forEach.prop (/var/www/webapps/caraka/source/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2173:25)
at Array.forEach (<anonymous>)
at PostgresQueryGenerator.whereItemsQuery (/var/www/webapps/caraka/source/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2171:35)
at PostgresQueryGenerator.whereQuery (/var/www/webapps/caraka/source/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2144:24)
at PostgresQueryGenerator.updateQuery (/var/www/webapps/caraka/source/node_modules/sequelize/lib/dialects/abstract/query-generator.js:435:116)
at QueryInterface.bulkUpdate (/var/www/webapps/caraka/source/node_modules/sequelize/lib/query-interface.js:1043:37)
at Promise.try.then.then.then.results (/var/www/webapps/caraka/source/node_modules/sequelize/lib/model.js:3226:34)
at tryCatcher (/var/www/webapps/caraka/source/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/var/www/webapps/caraka/source/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/var/www/webapps/caraka/source/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/var/www/webapps/caraka/source/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/var/www/webapps/caraka/source/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/var/www/webapps/caraka/source/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/var/www/webapps/caraka/source/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/var/www/webapps/caraka/source/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues (/var/www/webapps/caraka/source/node_modules/bluebird/js/release/async.js:15:14)
at Immediate.args.(anonymous function) (/usr/lib/node_modules/pm2/node_modules/event-loop-inspector/index.js:138:29)
at runCallback (timers.js:810:20)
at tryOnImmediate (timers.js:768:5)
at processImmediate [as _immediateCallback] (timers.js:745:5)
(node:23395) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 545)
(node:23395) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'map' of null
at Object.flush (/var/www/webapps/caraka/source/dist/src/utils/CacheHelper.js:216:27)
at <anonymous>
(node:23395) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 547)
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -19,10 +19,10 @@ const CONFIG_SENDER_NAME = "Nico Baruna <nico.baruna@gmail.com>"
const CONFIG_AUTH_EMAIL = "truckscale_app@banpuindo.co.id"
const CONFIG_AUTH_PASSWORD = ""
const ShellToUse = "bash"
const MYFILE = "/var/www/webapps/caraka/.pm2/logs/CHaT-API-error.log"
const KEYWORD = "SequelizeConnectionAcquireTimeoutError"
const MYFILE = "CHaT-API-error1.log"
const KEYWORD = "SequelizeConnectionAcquireTimeoutError:"
var statSize int
var statSize int64
func sendMail(errorMsg string) {
fmt.Println("Try sending email to " + CONFIG_SENDER_NAME)
......@@ -91,14 +91,15 @@ func readFile(fname string) {
}
defer file.Close()
buf := make([]byte, 362)
stat, err := os.Stat(fname)
if statSize < int(stat.Size()) {
statSize = int(stat.Size())
start := stat.Size() - 362
buf := make([]byte, int64(stat.Size()))
if statSize < int64(stat.Size()) {
statSize = int64(stat.Size())
start := stat.Size() - statSize
_, err = file.ReadAt(buf, start)
if err == nil && strings.Contains(string(buf), KEYWORD) {
fmt.Printf("%s\n", buf)
fmt.Println("error found at " + time.Now().String())
Native()
sendMail(string(buf))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment