[PR #1397] [MERGED] Add a lock to add_messages #1592

Closed
opened 2026-05-07 01:02:49 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/binwiederhier/ntfy/pull/1397
Author: @timofej673
Created: 7/22/2025
Status: Merged
Merged: 8/8/2025
Merged by: @binwiederhier

Base: mainHead: main


📝 Commits (4)

  • 006f73a Update message_cache.go
  • 214f70e Merge branch 'binwiederhier:main' into main
  • d9ecee7 Merge branch 'binwiederhier:main' into main
  • f8082d9 Update message_cache.go

📊 Changes

1 file changed (+22 additions, -8 deletions)

View changed files

📝 server/message_cache.go (+22 -8)

📄 Description

Fixes #1391
According to the rules of sqlite - there can only be one writer
So my change adds a lock via a mutex to add_messages to comply with this rule and not cause error "database is locked". I tested my version - everything works for me and this error disappeared
Also I formatted the code a little so that there are no extra tabs and spaces and something like that


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/binwiederhier/ntfy/pull/1397 **Author:** [@timofej673](https://github.com/timofej673) **Created:** 7/22/2025 **Status:** ✅ Merged **Merged:** 8/8/2025 **Merged by:** [@binwiederhier](https://github.com/binwiederhier) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (4) - [`006f73a`](https://github.com/binwiederhier/ntfy/commit/006f73af7d6af3c077eab926e6ef2e0e542e4803) Update message_cache.go - [`214f70e`](https://github.com/binwiederhier/ntfy/commit/214f70e62f0548abd39fa90c981144fe8cd98ac8) Merge branch 'binwiederhier:main' into main - [`d9ecee7`](https://github.com/binwiederhier/ntfy/commit/d9ecee72009479d8226617a3a1da158badd69faa) Merge branch 'binwiederhier:main' into main - [`f8082d9`](https://github.com/binwiederhier/ntfy/commit/f8082d94811a517bcfc3abf97e5b9cdda573bbf5) Update message_cache.go ### 📊 Changes **1 file changed** (+22 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `server/message_cache.go` (+22 -8) </details> ### 📄 Description Fixes #1391 According to the rules of sqlite - there can only be one writer So my change adds a lock via a mutex to add_messages to comply with this rule and not cause error "database is locked". I tested my version - everything works for me and this error disappeared Also I formatted the code a little so that there are no extra tabs and spaces and something like that --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-07 01:02:49 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#1592
No description provided.