From 2c9ea00ac6f3ac26d06ab268dcdb4027d4dd23cd Mon Sep 17 00:00:00 2001 From: Kai Reinhard Date: Wed, 18 Dec 2024 20:28:09 +0100 Subject: [PATCH] VisitorbookCache fixed. --- Migration-ToDo.adoc | 34 ------------------- .../business/orga/VisitorbookCache.kt | 6 ++-- 2 files changed, 3 insertions(+), 37 deletions(-) diff --git a/Migration-ToDo.adoc b/Migration-ToDo.adoc index 8ce71b5f48..d786c5799e 100644 --- a/Migration-ToDo.adoc +++ b/Migration-ToDo.adoc @@ -13,7 +13,6 @@ Aktuell: - Pagination of selects: Aktuell wird nicht DB-seitig paginiert, sondern immer die ganze Liste gefetched. - remove all BaseDO.xxxId (lazy fetch) and replace callee by baseDO?.id -- Wicket: CalendarPage als Default ersetzen, CalendarPages remove. - Entitygraphen nutzen: ConflictVacationCache, AuftragCache etc. - Auftrag editieren: massenhaft SQLs - employeeSalaryList: lädt wie blöde nach dem Editieren. (Excel-Exports auch zuviele SQLs) @@ -23,11 +22,6 @@ Aktuell: - Lazy-Breakpoint: AbstractLazyInitializer.initialize (#170) org.hibernate.persister.entity.AbstractEntityPersister#generateSelectLazy: -postrgesql.conf: - log_lock_waits = on - deadlock_timeout = '500ms' - log_min_duration_statement = 1000 # Optional: loggt Abfragen, die länger als 1 Sekunde dauern - History - Positionen etc. vernünftig anzeigen. @@ -67,37 +61,9 @@ Später Ganz später - Kalenderlist ruft x-fach DB: FIND GroupDO resultClass=GroupDO auf. -Migration employee timed attrs: -select a.createdat, a.createdby, a.modifiedat, a.modifiedby, a.start_time, a.end_time, a.employee_id, a.group_name, b.value, b.propertyname, b.createdby, b.createdat, b.modifiedby, b.modifiedat from t_fibu_employee_timed a JOIN t_fibu_employee_timedattr b ON a.pk=b.parent; - -employeestatus -employeeannualleave - Produktion: # In postgresql.conf (Neustart der Datenbank erforderlich) lock_timeout = '300s' # 5 minutes timeout for locks. statement_timeout = '300s' # 5 minutes timeout for SQL-commands. - -Rollback: -update t_configuration set configurationtype='INTEGER' where configurationtype='LONG'; -ALTER TABLE t_configuration RENAME COLUMN longvalue TO intvalue; - -Folgendes muss nur gemacht werden, bevor die Version 8.0 erneut installiert wird (die alte Version 7.5.1 läuft auch ohne diese Änderungen): -DELETE FROM t_flyway_schema_version WHERE installed_rank >= 43; -ALTER TABLE t_pf_history_attr DROP COLUMN old_value; -ALTER TABLE t_pf_history_attr DROP COLUMN optype; -DROP TABLE t_orga_visitorbook_entry; -DROP TABLE t_fibu_employee_valid_since_attr; - - - - -Scripts: -Faktura-Quote nach KJ/GJ - - import java.util.Objects - - 114: EmployeeCache.instance.getEmployeeByUserId - - 37: data class User(val id: Long?, val username: String, val name: String, val firstName: String) : Comparable { - - 266: var useYear = jahr?.toInt() ?: LocalDate.now().year - - - diff --git a/projectforge-business/src/main/kotlin/org/projectforge/business/orga/VisitorbookCache.kt b/projectforge-business/src/main/kotlin/org/projectforge/business/orga/VisitorbookCache.kt index f8b9f0dd12..314ce6720c 100644 --- a/projectforge-business/src/main/kotlin/org/projectforge/business/orga/VisitorbookCache.kt +++ b/projectforge-business/src/main/kotlin/org/projectforge/business/orga/VisitorbookCache.kt @@ -44,7 +44,7 @@ open class VisitorbookCache : AbstractCache() { /** * The key is the visitorbook id (database pk). Must be synchronized, because isn't only read. */ - private var visitorbookMap: Map = emptyMap() + private var visitorbookMap = mutableMapOf() fun getVisitorbookInfo(id: Long?): VisitorbookInfo? { id ?: return null @@ -57,9 +57,9 @@ open class VisitorbookCache : AbstractCache() { fun setExpired(id: Long?) { id ?: return // Should not happen. val info = synchronized(visitorbookMap) { - visitorbookMap[id] + visitorbookMap[id] ?: VisitorbookInfo().also { visitorbookMap[id] = it } } - info?.let { visitorbookInfo -> + info.let { visitorbookInfo -> persistenceService.executeQuery( queryVisitEntries, VisitorbookEntryDO::class.java,