mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Merge pull request #208 from Freika/fix/resources-consumption
Add resource limits to docker-compose.yml file and fix Immich import bug
This commit is contained in:
commit
71434ae019
8 changed files with 50 additions and 11 deletions
|
|
@ -1 +1 @@
|
|||
0.12.2
|
||||
0.12.3
|
||||
|
|
|
|||
24
CHANGELOG.md
24
CHANGELOG.md
|
|
@ -5,6 +5,30 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [0.12.3] — 2024-09-02
|
||||
|
||||
### Added
|
||||
|
||||
- Resource limits to docke-compose.yml file to prevent server overload. Feel free to adjust the limits to your needs.
|
||||
|
||||
```yml
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '0.50' # Limit CPU usage to 50% of one core
|
||||
memory: '2G' # Limit memory usage to 2GB
|
||||
```
|
||||
|
||||
### Fixed
|
||||
|
||||
- Importing geodata from Immich will now not throw an error in the end of the process
|
||||
|
||||
### Changed
|
||||
|
||||
- A notification about an existing import with the same name will now show the import name
|
||||
- Export file now also will contain `raw_dat` field for each point. This field contains the original data that was imported to the application.
|
||||
|
||||
|
||||
## [0.12.2] — 2024-08-28
|
||||
|
||||
### Added
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -39,7 +39,8 @@ class ExportSerializer
|
|||
tst: point.timestamp.to_i,
|
||||
inrids: point.inrids,
|
||||
inregions: point.in_regions,
|
||||
topic: point.topic
|
||||
topic: point.topic,
|
||||
raw_data: point.raw_data
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@ class Immich::ImportGeodata
|
|||
raise ArgumentError, 'Immich API key is missing' if immich_api_key.blank?
|
||||
raise ArgumentError, 'Immich URL is missing' if user.settings['immich_url'].blank?
|
||||
|
||||
immich_data = retrieve_immich_data
|
||||
immich_data = retrieve_immich_data
|
||||
immich_data_json = parse_immich_data(immich_data)
|
||||
file_name = file_name(immich_data_json)
|
||||
import = user.imports.find_or_initialize_by(name: file_name, source: :immich_api)
|
||||
|
||||
create_import_failed_notification and return unless import.new_record?
|
||||
create_import_failed_notification(import.name) and return unless import.new_record?
|
||||
|
||||
import.raw_data = immich_data_json
|
||||
import.save!
|
||||
|
|
@ -84,12 +84,12 @@ class Immich::ImportGeodata
|
|||
Rails.logger.debug 'No data found'
|
||||
end
|
||||
|
||||
def create_import_failed_notification
|
||||
def create_import_failed_notification(import_name)
|
||||
Notifications::Create.new(
|
||||
user:,
|
||||
kind: :info,
|
||||
title: 'Import was not created',
|
||||
content: 'Import with the same name already exists. If you want to proceed, delete the existing import and try again.'
|
||||
content: "Import with the same name (#{import_name}) already exists. If you want to proceed, delete the existing import and try again."
|
||||
).call
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ class Immich::ImportParser
|
|||
|
||||
def call
|
||||
json.each { |point| create_point(point) }
|
||||
|
||||
{ raw_points: 0, points: 0, doubles: 0, processed: 0 }
|
||||
end
|
||||
|
||||
def create_point(point)
|
||||
|
|
|
|||
|
|
@ -57,6 +57,11 @@ services:
|
|||
depends_on:
|
||||
- dawarich_db
|
||||
- dawarich_redis
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '0.50' # Limit CPU usage to 50% of one core
|
||||
memory: '2G' # Limit memory usage to 2GB
|
||||
dawarich_sidekiq:
|
||||
image: freikin/dawarich:latest
|
||||
container_name: dawarich_sidekiq
|
||||
|
|
@ -90,6 +95,11 @@ services:
|
|||
- dawarich_db
|
||||
- dawarich_redis
|
||||
- dawarich_app
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '0.50' # Limit CPU usage to 50% of one core
|
||||
memory: '2G' # Limit memory usage to 2GB
|
||||
|
||||
volumes:
|
||||
db_data:
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ RSpec.describe ExportSerializer do
|
|||
tst: points.first.timestamp.to_i,
|
||||
inrids: points.first.inrids,
|
||||
inregions: points.first.in_regions,
|
||||
topic: points.first.topic
|
||||
topic: points.first.topic,
|
||||
raw_data: points.first.raw_data
|
||||
},
|
||||
{
|
||||
lat: points.second.latitude,
|
||||
|
|
@ -50,7 +51,8 @@ RSpec.describe ExportSerializer do
|
|||
tst: points.second.timestamp.to_i,
|
||||
inrids: points.second.inrids,
|
||||
inregions: points.second.in_regions,
|
||||
topic: points.second.topic
|
||||
topic: points.second.topic,
|
||||
raw_data: points.second.raw_data
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue