jbostoen / itop-jb-report-generator

https://jeffreybostoen.be
2 stars 2 forks source link

Memory usage peaks due to fetching of attachments #13

Closed jbostoen closed 9 months ago

jbostoen commented 10 months ago

Even for reports where eventually nothing at all is done with attachments, attachments are queried by default.

This leads to (much) longer processing as the amount of attachments grows.

There are some use cases where attachments need to be fetched, e.g. to render attached images (for example: photos attached to a user request).

jbostoen commented 10 months ago

This will very likely break backward compatibility.

Basically, attachments should definitely not always be fetched by default.

It makes sense to put this in its own ReportProcessor.

By default, there could be one which is NOT enabled; but can be used to easily extend.

As an example, or included in the default, there could be some logic to see if an existing template contains some sort of indicator of attachments. item.attachment is an easy one to check. However, for lists, the item variable could be named anything. So the broader .attachment might be more suitable (even if it's likely to generate more false positives as well).