LibrePhotos / librephotos

A self-hosted open source photo management service. This is the repository of the backend.
MIT License
6.97k stars 305 forks source link

Heavyweight Processes cannot be set to value lower than 4 #1138

Closed fimholz closed 9 months ago

fimholz commented 9 months ago

šŸ› Bug Report

šŸ“ Description of issue:

Some weeks ago there was a change which allows up to 10 heavyweight processes. At least since then I cannot set a value between 1-3 from the frontend. I was able to change it back to the default with the help of django-admin. There are error logs from the backend container complaining that the new value is not a number --> this applies for [1,2,3] but not when setting 4+.

šŸ” How can we reproduce it:

  1. Open Admin Area
  2. Set Heavyweight Processes to a value 1, 2 or 3
  3. Reload the page --> the value is reset to the value before
  4. Set Heavyweight Processes to a value >3
  5. Reload the page --> the value is set correctly but cannot be set back to 1..3

From the logs: jsonschema.exceptions.ValidationError: '2' is not of type 'number'

Please provide additional information:

Docker Logs (backend)

Unauthorized: /api/storagestats
/usr/local/lib/python3.11/dist-packages/rest_framework/pagination.py:200: UnorderedObjectListWarning: Pagination may yield inconsistent results with an unordered object_list: <class 'api.models.person.Person'> QuerySet.
  paginator = self.django_paginator_class(queryset, page_size)
Internal Server Error: /api/sitesettings
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/django/views/decorators/csrf.py", line 56, in wrapper_view
    return view_func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/usr/local/lib/python3.11/dist-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/usr/local/lib/python3.11/dist-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/code/api/views/views.py", line 95, in post
    jsonschema.validate(request.data, site_settings_schema)
  File "/usr/local/lib/python3.11/dist-packages/jsonschema/validators.py", line 1308, in validate
    raise error
jsonschema.exceptions.ValidationError: '2' is not of type 'number'
Failed validating 'type' in schema['properties']['heavyweight_process']:
    {'type': 'number'}
On instance['heavyweight_process']:
    '2'
derneuere commented 9 months ago

Thanks, found the bug and pushed a fix :)