MCPcopy Create free account
hub / github.com/actionhero/node-resque / saveLastError

Method saveLastError

src/plugins/Retry.ts:144–178  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

142 }
143
144 async saveLastError() {
145 const now = new Date();
146 const failedAt =
147 "" +
148 now.getFullYear() +
149 "/" +
150 ("0" + (now.getMonth() + 1)).slice(-2) +
151 "/" +
152 ("0" + now.getDate()).slice(-2) +
153 " " +
154 ("0" + now.getHours()).slice(-2) +
155 ":" +
156 ("0" + now.getMinutes()).slice(-2) +
157 ":" +
158 ("0" + now.getSeconds()).slice(-2);
159 const backtrace = this.worker.error.stack
160 ? this.worker.error.stack.split(os.EOL) || []
161 : [];
162
163 const data = {
164 failed_at: failedAt,
165 payload: this.args,
166 exception: String(this.worker.error),
167 error: String(this.worker.error),
168 backtrace: backtrace,
169 worker: this.func,
170 queue: this.queue,
171 };
172
173 await this.redis().setex(
174 this.failureKey(),
175 this.maxDelay(),
176 JSON.stringify(data),
177 );
178 }
179
180 async cleanup() {
181 await this.redis().del(this.retryKey());

Callers 1

afterPerformMethod · 0.95

Calls 3

redisMethod · 0.95
failureKeyMethod · 0.95
maxDelayMethod · 0.95

Tested by

no test coverage detected