Skip to content

Commit 0f2641b

Browse files
committed
clean: remove some unused code/comments
1 parent b2ea8a3 commit 0f2641b

File tree

5 files changed

+8
-27
lines changed

5 files changed

+8
-27
lines changed

src/backend/src/filesystem/hl_operations/hl_data_read.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,11 @@ class HLDataRead extends HLFilesystemOperation {
7575

7676
const output_stream = new PassThrough();
7777

78-
new Promise((resolve, reject) => {
79-
rl.on('line', (line) => {
80-
output_stream.write(line);
81-
});
82-
rl.on('close', () => {
83-
output_stream.end();
84-
resolve();
85-
});
78+
rl.on('line', (line) => {
79+
output_stream.write(line);
80+
});
81+
rl.on('close', () => {
82+
output_stream.end();
8683
});
8784

8885
return output_stream;

src/backend/src/middleware/abuse.js

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const APIError = require("../api/APIError");
2020
const { Context } = require("../util/context");
2121

2222
const abuse = options => (req, res, next) => {
23-
// const svc_abuse = x.get('services').get('abuse-prevention');
2423
const requester = Context.get('requester');
2524

2625
if ( options.no_bots ) {

src/backend/src/modules/core/AlarmService.js

+2-11
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ class AlarmService extends BaseService {
7171
* @returns {void}
7272
*/
7373
this.alarm_widget = () => {
74-
// return `\x1B[31;1m alarms (${
75-
// Object.keys(this.alarms)
76-
// })\x1B[0m`;
7774
const lines = [];
7875
for ( const alarm of Object.values(this.alarms) ) {
7976
const line =
@@ -97,12 +94,6 @@ class AlarmService extends BaseService {
9794
}
9895

9996
adapt_id_ (id) {
100-
// let shorten = false;
101-
// // Check if id uses characters that aren't on a US QWERTY keyboard.
102-
// if ( /[^\x20-\x7E]/.test(id) ) shorten = true;
103-
104-
// // Check if id is too long
105-
// if ( id.length > 20 ) shorten = true;
10697
let shorten = true;
10798

10899
if ( shorten ) {
@@ -344,7 +335,7 @@ class AlarmService extends BaseService {
344335
// Write a .log file for the alert that happened
345336
try {
346337
const lines = [];
347-
lines.push(`ALERT ${alarm.id_string} :: ${alarm.message} (${alarm.count})`),
338+
lines.push(`ALERT ${alarm.id_string} :: ${alarm.message} (${alarm.count})`);
348339
lines.push(`started: ${new Date(alarm.started).toISOString()}`);
349340
lines.push(`short id: ${alarm.short_id}`);
350341
lines.push(`original id: ${alarm.id}`);
@@ -356,7 +347,7 @@ class AlarmService extends BaseService {
356347

357348
(async () => {
358349
try {
359-
await fs.appendFileSync(`alert_${alarm.id}.log`, alert_info + '\n');
350+
fs.appendFileSync(`alert_${alarm.id}.log`, alert_info + '\n');
360351
} catch (e) {
361352
this.log.error(`failed to write alert log: ${e.message}`);
362353
}

src/backend/src/modules/core/ProcessEventService.js

-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ class ProcessEventService extends BaseService {
3838
const log = services.get('log-service').create('process-event-service');
3939
const errors = services.get('error-service').create(log);
4040

41-
// TODO: when the service lifecycle is implemented, but these
42-
// in the init hook
43-
4441
process.on('uncaughtException', async (err, origin) => {
4542
/**
4643
* Handles uncaught exceptions in the process

src/backend/src/modules/puterai/AIChatService.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ class AIChatService extends BaseService {
116116
}
117117
}
118118

119-
// TODO: get models and pricing for each model
120119
for ( const provider of this.providers ) {
121120
const delegate = this.services.get(provider.service_name)
122121
.as('puter-chat-completion');
@@ -289,7 +288,7 @@ class AIChatService extends BaseService {
289288
}
290289

291290
const svc_driver = this.services.get('driver');
292-
let ret, error, errors = [];
291+
let ret, error;
293292
let service_used = intended_service;
294293
let model_used = this.get_model_from_request(parameters, {
295294
intended_service
@@ -315,7 +314,6 @@ class AIChatService extends BaseService {
315314
tried.push(model);
316315

317316
error = e;
318-
errors.push(e);
319317
console.error(e);
320318
this.log.error('error calling service', {
321319
intended_service,
@@ -368,7 +366,6 @@ class AIChatService extends BaseService {
368366
};
369367
} catch (e) {
370368
error = e;
371-
errors.push(e);
372369
tried.push(fallback_model_name);
373370
this.log.error('error calling fallback', {
374371
intended_service,

0 commit comments

Comments
 (0)