cds-snc / cds-snc/platform-forms-client

ResponseDownloadLogger refactor

Open
#6,331 0 comments 0 reactions 0 assignees View on GitHub
responses tech debt
Dominant language
TypeScript
Stars
46
Forks
16
Avg merge
1d 8h
Merged PRs (30d)
85

Description

Refactor the `ResponseDownloadLogger` for optimization and performance.

### Current behaviour:
For every line to be added to the logger file the system:
1. Opens the logger file
2. Reads the full content of the file to memory
3. Adds the line to the end of the content
4. Rewrites the whole file back to disk
5. Closes the file handle.

This can lead to a very heavy burden on the file system and memory for very verbose actions.

### Ideal behaviour:
The ResponseDownloadLogger batches messages to be logged or keeps a file handle open and appends data as needed.

Try to avoid reading the whole file into memory or multiple filehandle open/close for each response retrieval flow.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.