mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
Write Immich debug data and fix Sidekiq healthcheck
This commit is contained in:
parent
355a517893
commit
609688f144
4 changed files with 34 additions and 4 deletions
|
|
@ -1 +1 @@
|
|||
0.15.10
|
||||
0.15.11
|
||||
|
|
|
|||
19
CHANGELOG.md
19
CHANGELOG.md
|
|
@ -5,6 +5,25 @@ 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.15.11 - 2024-10-29
|
||||
|
||||
### Added
|
||||
|
||||
- Importing Immich data on the Imports page now will trigger an attempt to write raw json file with the data from Immich to `tmp/imports/immich_raw_data_CURRENT_TIME_USER_EMAIL.json` file. This is useful to debug the problem with the import if it fails. #270
|
||||
|
||||
### Changed
|
||||
|
||||
- Hostname definition for Sidekiq healtcheck to solve #344. See the diff:
|
||||
|
||||
```diff
|
||||
dawarich_sidekiq:
|
||||
image: freikin/dawarich:latest
|
||||
container_name: dawarich_sidekiq
|
||||
healthcheck:
|
||||
- test: [ "CMD-SHELL", "bundle exec sidekiqmon processes | grep $(hostname)" ]
|
||||
+ test: [ "CMD-SHELL", "bundle exec sidekiqmon processes | grep ${HOSTNAME}" ]
|
||||
```
|
||||
|
||||
# 0.15.10 - 2024-10-25
|
||||
|
||||
### Fixed
|
||||
|
|
|
|||
|
|
@ -13,7 +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
|
||||
|
||||
log_no_data and return if immich_data.empty?
|
||||
|
||||
write_raw_data(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)
|
||||
|
|
@ -35,7 +40,7 @@ class Immich::ImportGeodata
|
|||
end
|
||||
|
||||
def retrieve_immich_data
|
||||
1970.upto(Date.today.year).flat_map do |year|
|
||||
1970.upto(Time.zone.today.year).flat_map do |year|
|
||||
(1..12).map do |month_number|
|
||||
url = "#{immich_api_base_url}/timeline/bucket?size=MONTH&timeBucket=#{year}-#{month_number}-01"
|
||||
|
||||
|
|
@ -72,6 +77,12 @@ class Immich::ImportGeodata
|
|||
Rails.logger.debug 'No data found'
|
||||
end
|
||||
|
||||
def write_raw_data(immich_data)
|
||||
File.open("tmp/imports/immich_raw_data_#{Time.current}_#{user.email}.json", 'w') do |file|
|
||||
file.write(immich_data.to_json)
|
||||
end
|
||||
end
|
||||
|
||||
def create_import_failed_notification(import_name)
|
||||
Notifications::Create.new(
|
||||
user:,
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ services:
|
|||
max-size: "100m"
|
||||
max-file: "5"
|
||||
healthcheck:
|
||||
test: [ "CMD-SHELL", "bundle exec sidekiqmon processes | grep $(hostname)" ]
|
||||
test: [ "CMD-SHELL", "bundle exec sidekiqmon processes | grep ${HOSTNAME}" ]
|
||||
interval: 10s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
|
|
|
|||
Loading…
Reference in a new issue