Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerbutler committed Oct 30, 2020
1 parent ee5c2e4 commit b17ce0d
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 8 deletions.
5 changes: 5 additions & 0 deletions server/routerlicious/packages/lambdas/src/alfred/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ export function configureWebSocketServices(
if (isWriter(messageClient.scopes, details.existing, message.mode)) {
const orderer = await orderManager.getOrderer(claims.tenantId, claims.documentId);
const connection = await orderer.connect(socket, clientId, messageClient as IClient, details);
// eslint-disable-next-line @typescript-eslint/no-floating-promises
connection.connect();

connectionsMap.set(clientId, connection);
Expand Down Expand Up @@ -298,6 +299,7 @@ export function configureWebSocketServices(
}

// Note connect is a reserved socket.io word so we use connect_document to represent the connect request
// eslint-disable-next-line @typescript-eslint/no-misused-promises
socket.on("connect_document", async (connectionMessage: IConnect) => {
connectDocument(connectionMessage).then(
(message) => {
Expand Down Expand Up @@ -355,6 +357,7 @@ export function configureWebSocketServices(
.map((message) => sanitizeMessage(message));

if (sanitized.length > 0) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
connection.order(sanitized);
}
});
Expand Down Expand Up @@ -386,6 +389,7 @@ export function configureWebSocketServices(
}
});

// eslint-disable-next-line @typescript-eslint/no-misused-promises
socket.on("disconnect", async () => {
clearExpirationTimer();
// Send notification messages for all client IDs in the connection map
Expand All @@ -395,6 +399,7 @@ export function configureWebSocketServices(
tenantId: connection.tenantId,
};
logger.info(`Disconnect of ${clientId}`, { messageMetaData });
// eslint-disable-next-line @typescript-eslint/no-floating-promises
connection.disconnect();
}
// Send notification messages for all client IDs in the room map
Expand Down
3 changes: 0 additions & 3 deletions server/routerlicious/packages/lambdas/src/scribe/lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,8 @@ export class ScribeLambda extends SequencedLambda {
private readonly checkpointManager: ICheckpointManager,
scribe: IScribe,
private readonly producer: IProducer | undefined,
// eslint-disable-next-line @typescript-eslint/prefer-readonly
private protocolHandler: ProtocolOpHandler,
// eslint-disable-next-line @typescript-eslint/prefer-readonly
private term: number,
// eslint-disable-next-line @typescript-eslint/prefer-readonly
private protocolHead: number,
messages: ISequencedDocumentMessage[],
private readonly generateServiceSummary: boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export class LocalLambdaController extends EventEmitter implements IKafkaSubscri
this.context.error(ex, true);

this.startTimer = setTimeout(() => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.start();
}, 5000);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ export class LocalNode extends EventEmitter implements IConcreteNode {

private constructor(
private readonly webSocketServerFactory: () => IWebSocketServer,
// eslint-disable-next-line @typescript-eslint/prefer-readonly
private node: INode,
private readonly storage: IDocumentStorage,
private readonly databaseManager: IDatabaseManager,
Expand Down Expand Up @@ -196,6 +195,7 @@ export class LocalNode extends EventEmitter implements IConcreteNode {
moniker.choose(),
connectMessage.client);

// eslint-disable-next-line @typescript-eslint/no-floating-promises
connection.connect();

// Need to subscribe to both channels. Then broadcast subscription across pipe
Expand All @@ -218,6 +218,7 @@ export class LocalNode extends EventEmitter implements IConcreteNode {
case "disconnect": {
const connection = this.connectionMap.get(message.cid);
assert(connection);
// eslint-disable-next-line @typescript-eslint/no-floating-promises
connection.disconnect();
this.connectionMap.delete(message.cid);

Expand All @@ -228,6 +229,7 @@ export class LocalNode extends EventEmitter implements IConcreteNode {
const orderMessage = message.payload as IDocumentMessage;
const connection = this.connectionMap.get(message.cid);
assert(connection);
// eslint-disable-next-line @typescript-eslint/no-floating-promises
connection.order([orderMessage]);
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,22 +356,27 @@ export class LocalOrderer implements IOrderer {

private startLambdas() {
if (this.deliLambda) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.deliLambda.start();
}

if (this.scriptoriumLambda) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.scriptoriumLambda.start();
}

if (this.foremanLambda) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.foremanLambda.start();
}

if (this.scribeLambda) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.scribeLambda.start();
}

if (this.broadcasterLambda) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.broadcasterLambda.start();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export class LocalOrdererConnection implements IOrdererConnection {
};

// Submits the message.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.producer.send([boxcar], this.tenantId, this.documentId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,13 @@ function sendJoin(tenantId: string, documentId: string, clientId: string, produc
};

const joinMessage = craftClientJoinMessage(tenantId, documentId, clientDetail);
// eslint-disable-next-line @typescript-eslint/no-floating-promises
producer.send([joinMessage], tenantId, documentId);
}

function sendLeave(tenantId: string, documentId: string, clientId: string, producer: core.IProducer) {
const leaveMessage = craftClientLeaveMessage(tenantId, documentId, clientId);
// eslint-disable-next-line @typescript-eslint/no-floating-promises
producer.send([leaveMessage], tenantId, documentId);
}

Expand All @@ -126,6 +128,7 @@ function sendOp(
clientId,
JSON.stringify(content),
clientSequenceNumber++);
// eslint-disable-next-line @typescript-eslint/no-floating-promises
producer.send([opMessage], tenantId, documentId);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ export class AlfredRunner implements utils.IRunner {
private onListening() {
const addr = this.server.httpServer.address();
const bind = typeof addr === "string"
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
? `pipe ${addr}`
: `port ${addr.port}`;
winston.info(`Listening on ${bind}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export class NodeErrorTrackingService implements IErrorTrackingService {
public captureException(error: any): string | undefined {
if (error.tenantId && error.documentId) {
Sentry.withScope((scope) => {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
scope.setTag("document", `${error.tenantId}/${error.documentId}`);
Sentry.captureException(error.error);
});
Expand Down
1 change: 0 additions & 1 deletion server/routerlicious/packages/services-utils/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export function configureLogging(config: IWinstonConfig) {
// eslint-disable-next-line space-before-function-paren
(debug as any).formatArgs = function (args) {
const name = this.namespace;
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
args[0] = `${name} ${args[0]}`;
};
}
1 change: 1 addition & 0 deletions server/routerlicious/packages/services-utils/src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export async function run<T extends IResources>(
// Start the runner and then listen for the message to stop it
const runningP = runner.start();
process.on("SIGTERM", () => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
runner.stop();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export class KafkaNodeConsumer implements IConsumer {
private readonly topicReplicationFactor?: number,
private readonly reconnectDelay: number = defaultReconnectDelay) {
clientOptions.clientId = clientId;
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.connect();
if (zookeeperEndpoint) {
this.zookeeper = new ZookeeperClient(zookeeperEndpoint);
Expand Down Expand Up @@ -106,6 +107,7 @@ export class KafkaNodeConsumer implements IConsumer {
this.events.emit("error", error);

setTimeout(() => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.connect();
}, this.reconnectDelay);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class RabbitmqReceiver implements ITaskMessageReceiver {

// We don't need to ack the task messages since they will be part of next help message if unacked.
// TODO: Reject messages and make sure the sender knows.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.channel.consume(this.taskQueueName, (msgBuffer) => {
const msgString = msgBuffer.content.toString();
const msg = JSON.parse(msgString) as ITaskMessage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export class NodeCodeLoader {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return entry;
} else {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
Promise.reject("Invalid Package");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class RdkafkaProducer extends RdkafkaBase implements IProducer {
/**
* Sends the provided message to Kafka
*/
// eslint-disable-next-line @typescript-eslint/promise-function-async
// eslint-disable-next-line @typescript-eslint/ban-types,@typescript-eslint/promise-function-async
public send(messages: object[], tenantId: string, documentId: string): Promise<any> {
const key = `${tenantId}/${documentId}`;

Expand Down

0 comments on commit b17ce0d

Please sign in to comment.