forked from noxious/server
Attempt to fix performance :(((
This commit is contained in:
@ -32,7 +32,6 @@ interface IPayload {
|
||||
}
|
||||
|
||||
export default class MapUpdateEvent extends BaseEvent {
|
||||
private readonly populateOptions = ['mapEventTiles', 'placedMapObjects', 'mapEffects'];
|
||||
public listen(): void {
|
||||
this.socket.on('gm:map:update', this.handleEvent.bind(this))
|
||||
}
|
||||
@ -57,8 +56,7 @@ export default class MapUpdateEvent extends BaseEvent {
|
||||
return callback(null)
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
await mapRepository.getEntityManager().populate(map, this.populateOptions)
|
||||
await mapRepository.getEntityManager().populate(map, mapRepository.POPULATE_MAP_EDITOR as any)
|
||||
|
||||
// Validation logic remains the same
|
||||
if (data.tiles.length > data.height) {
|
||||
@ -122,9 +120,7 @@ export default class MapUpdateEvent extends BaseEvent {
|
||||
|
||||
// Reload map from database to get fresh data
|
||||
map = await mapRepository.getById(data.mapId)
|
||||
|
||||
// @ts-ignore
|
||||
await mapRepository.getEntityManager().populate(map!, this.populateOptions)
|
||||
await mapRepository.getEntityManager().populate(map!, mapRepository.POPULATE_MAP_EDITOR as any)
|
||||
|
||||
if (!map) {
|
||||
this.logger.info(`User ${character!.getId()} tried to update map ${data.mapId} but it does not exist after update.`)
|
||||
|
Reference in New Issue
Block a user