Nriver / trilium-py

Python client for ETAPI of Trilium Note. Trilium 的 Python版 ETAPI 客户端
GNU Affero General Public License v3.0
118 stars 27 forks source link

Duplicate Journal Day Note #13

Closed jwhonce closed 1 year ago

jwhonce commented 1 year ago

I am not sure this is a trilium-py or trilium sync server issue. Or, mine...

I wrote a script to query critical items from Jira and create TODO items for me on the Journal Day Note. The script works fine when the Day note exists.

When it creates a new empty page (3am via cron) and then I press the "Open Today's Journal Note" launcher (at 8am) the launcher creates a second note for the day... The note created by trilium-py has the TODO items and my Day template contents while the launcher note only has my "Day template" contents.

I am running a sync server (quadlet/podman) and the script is configured to run against that server. The launcher, of course, is run on my laptop.

Is it "bad" style to call the ETAPI endpoint refresh-note-ordering after creating the Day note? That is the only ETAPI endpoint that seems to push to clients. At least from the OpenAPI spec. Or, there appears to be apiRoute(POST, '/api/sync/now'

Homepage: https://github.com/zadam/trilium App version: 0.60.4 DB version: 214 Sync version: 29 Build date: 2023-06-19T23:26:50+02:00 Build revision: 5905950c17791ce0eb278e010c2c8b3450fdb447 Data directory: .../.local/share/trilium-data Image: docker.io/zadam/trilium:0.60.4

Nriver commented 1 year ago

Assume the script creates a day note with id1 which is saved on your server.

If you click the today button before the client finish syncing, the client will create a new day note with id2, as it does not aware of the id1 note. Then, after the sync, client will have two notes of the same day with both id1 and id2.

If you could wait for the syncing to finish for few seconds, the client will recognize the id1 note and use it for the day button.

jwhonce commented 1 year ago

I have workflow that is working. I plan on submitting a PR with a new close() method to call /api/sync/now endpoint. If you have no objections.

Nriver commented 1 year ago

Contribution is always welcome.

jwhonce commented 1 year ago

Fixed #15