openlibhums / janeway

A web-based platform for publishing journals, preprints, conference proceedings, and books
https://janeway.systems/
GNU Affero General Public License v3.0
177 stars 65 forks source link

Dev middleware TimeMonitoring does not work on Macs #4459

Open joemull opened 1 month ago

joemull commented 1 month ago

Problem

The TimeMonitoring middleware does not work on Darwin / Mac OSX due to an unavailable attribute resource.RUSAGE_THREAD.

https://github.com/openlibhums/janeway/blob/30fb420ab695d542962770d35f83e7059e9c9c22/src/utils/middleware.py#L76-L79

Proposed solution

Add a try / except to catch the attribute error, and try to fetch the appropriate Darwin resource. If that does not work, exit the middleware gracefully but allow Janeway to run.