Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release: Fixes #35

Merged
merged 6 commits into from
Jul 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
additional startup params
techsmyth committed Jul 3, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 3d2261bdf212897091a5ea06a248a19d011878e8
4 changes: 4 additions & 0 deletions service/matrix-adapter.yml
Original file line number Diff line number Diff line change
@@ -80,6 +80,10 @@ matrix:
client:
# The URL of the timeline support client
timelineSupport: ${MATRIX_CLIENT_TIMELINE_SUPPORT}:true
# The polling timeout of the timeline support client
startupPollTimeout: ${MATRIX_CLIENT_STARTUP_POLL_TIMEOUT}:100000
# The polling timeout of the timeline support client
startupInitialSyncLimit: ${MATRIX_CLIENT_STARTUP_SYNC_LIMIT}:20

admin:
# The admin account that is created / used to administer the regular users on the Synapse server
2 changes: 1 addition & 1 deletion service/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alkemio-matrix-adapter",
"version": "0.3.3",
"version": "0.3.4",
"description": "Alkemio Matrix Adapter service",
"author": "Alkemio Foundation",
"private": false,
6 changes: 6 additions & 0 deletions service/src/services/matrix/agent/matrix.agent.service.ts
Original file line number Diff line number Diff line change
@@ -40,6 +40,7 @@ export class MatrixAgentService {
matrixClient,
this.matrixRoomAdapter,
this.matrixMessageAdapter,
this.configService,
this.logger
);
}
@@ -59,6 +60,11 @@ export class MatrixAgentService {
const timelineSupport: boolean = this.configService.get(
ConfigurationTypes.MATRIX
)?.client.timelineSupport;

this.logger.verbose?.(
`Creating Matrix Client for ${operator.username} using timeline flag: ${timelineSupport}`,
LogContext.MATRIX
);
const createClientInput: ICreateClientOpts = {
baseUrl: baseUrl,
idBaseUrl: idBaseUrl,
30 changes: 27 additions & 3 deletions service/src/services/matrix/agent/matrix.agent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LogContext } from '@common/enums';
import { ConfigurationTypes, LogContext } from '@common/enums';
import { LoggerService } from '@nestjs/common';
import {
autoAcceptRoomGuardFactory,
@@ -17,7 +17,8 @@ import { MatrixMessageAdapter } from '../adapter-message/matrix.message.adapter'
import { MatrixRoomAdapter } from '../adapter-room/matrix.room.adapter';
import { IMatrixAgent } from './matrix.agent.interface';
import { Disposable } from '@src/common/interfaces/disposable.interface';
import { MatrixClient } from 'matrix-js-sdk';
import { MatrixClient, IStartClientOpts } from 'matrix-js-sdk';
import { ConfigService } from '@nestjs/config';

export type MatrixAgentStartOptions = {
registerTimelineMonitor?: boolean;
@@ -30,17 +31,20 @@ export class MatrixAgent implements IMatrixAgent, Disposable {
eventDispatcher: MatrixEventDispatcher;
roomAdapter: MatrixRoomAdapter;
messageAdapter: MatrixMessageAdapter;
configService: ConfigService;

constructor(
matrixClient: MatrixClient,
roomAdapter: MatrixRoomAdapter,
messageAdapter: MatrixMessageAdapter,
configService: ConfigService,
private logger: LoggerService
) {
this.matrixClient = matrixClient;
this.eventDispatcher = new MatrixEventDispatcher(this.matrixClient);
this.roomAdapter = roomAdapter;
this.messageAdapter = messageAdapter;
this.configService = configService;
}

attach(handler: IMatrixEventHandler) {
@@ -77,7 +81,27 @@ export class MatrixAgent implements IMatrixAgent, Disposable {
);
});

await this.matrixClient.startClient({});
const pollTimeout = Number(
this.configService.get(ConfigurationTypes.MATRIX)?.client
.startupPollTimeout
);

const initialSyncLimit = Number(
this.configService.get(ConfigurationTypes.MATRIX)?.client
.startupInitialSyncLimit
);

this.logger.verbose?.(
`starting up with pollTimeout: ${pollTimeout} and initialSyncLimit: ${initialSyncLimit}`,
LogContext.MATRIX
);

const startClientOptions: IStartClientOpts = {
disablePresence: true,
initialSyncLimit: initialSyncLimit,
pollTimeout: pollTimeout,
};
await this.matrixClient.startClient(startClientOptions);
await startComplete;

const eventHandler: IMatrixEventHandler = {
Original file line number Diff line number Diff line change
@@ -43,6 +43,10 @@ export class MatrixUserManagementService {
const timelineSupport: boolean = this.configService.get(
ConfigurationTypes.MATRIX
)?.client.timelineSupport;
this.logger.verbose?.(
`Creating Matrix Client for management using timeline flag: ${timelineSupport}`,
LogContext.MATRIX
);
const createClientInput: ICreateClientOpts = {
baseUrl: this.baseUrl,
idBaseUrl: this.idBaseUrl,