[TASKMGMT-22] Newly created tasks may not be stored in proper date folder Created: 18/Dec/15  Updated: 27/May/21  Resolved: 26/Jan/16

Status: Closed
Project: Task Management
Component/s: None
Affects Version/s: None
Fix Version/s: 1.1.1

Type: Bug Priority: Critical
Reporter: Andreas Weder Assignee: Federico Grilli
Resolution: Fixed Votes: 0
Labels: support, tasks
Remaining Estimate: 0d
Time Spent: 0.75d
Original Estimate: Not Specified

Issue Links:
dependency
duplicate
is duplicated by MGNLUI-3936 Newly created messages are not be sto... Accepted
relation
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Sprint: Basel 28
Story Points: 3

 Description   

Customer reports that *freshly created tasks are not always stored into the correct folder*s. While it seems that task should be added into month and day directories in JCR, that sometimes does not seem to happen. As a result, the customer ends up with too many nodes in a single folder, causing performance problems.

Please research this and provide a fix for it, if necessary.


UPDATE
The issue seems to be caused by the following:
info.magnolia.task.persistence.TasksStoreImpl is a singleton which is injected with TaskPathGenerator. The latter initialises

private AtomicLong atomicLong = new AtomicLong(System.currentTimeMillis());

Each time a new task is persisted (created as new or updated) the following happens at
info.magnolia.task.persistence.TasksStoreImpl.persist(Task)

   String taskNodeName = String.valueOf(taskPathGenerator.incrementAndGet());
   String parentPath = taskPathGenerator.getParentPath(taskNodeName);

So, the parent path (e.g. /tasks/2015/11/2) is obtained by incrementing a counter which started at some point in time in the past, i.e. when TaskPathGenerator was instantiated and not necessarily reflects the current date.


Generated at Mon Feb 12 11:02:20 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.