Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
2c559de
unfinished
go-while Oct 4, 2025
40714b3
unfinished
go-while Oct 4, 2025
88ede5a
unfinished
go-while Oct 4, 2025
72b9ab5
unfinished
go-while Oct 5, 2025
0fd24a1
unfinished
go-while Oct 5, 2025
6d3743f
almost finished
go-while Oct 5, 2025
5b72552
eat my mem
go-while Oct 5, 2025
91304c0
Update headers.go
go-while Oct 5, 2025
a4cad64
testing
go-while Oct 5, 2025
b8009d2
Update main.go
go-while Oct 5, 2025
b891f50
merge shit
go-while Oct 5, 2025
3dd2379
Update main.go
go-while Oct 6, 2025
436c15e
testing
go-while Oct 6, 2025
ffc4c54
-tmpMessageIDs
go-while Oct 6, 2025
e0acbd7
testing
go-while Oct 7, 2025
a86af64
takeThisChan unbuffered
go-while Oct 7, 2025
9a8d8d1
testing
go-while Oct 7, 2025
01baf48
Update main.go
go-while Oct 7, 2025
09dafab
q1
go-while Oct 7, 2025
4197d36
testing
go-while Oct 8, 2025
b58831b
testing
go-while Oct 8, 2025
cb4f214
testing
go-while Oct 8, 2025
e940a1e
testing
go-while Oct 8, 2025
432ab58
testing
go-while Oct 9, 2025
b2fdbe1
testing Q*2
go-while Oct 9, 2025
64d8bb6
testing
go-while Oct 9, 2025
9c5f068
testing
go-while Oct 9, 2025
eee8765
debugs
go-while Oct 9, 2025
456fdde
testing
go-while Oct 9, 2025
0118967
debugs
go-while Oct 9, 2025
7210d22
testing mutex
go-while Oct 9, 2025
ef2fd97
testing
go-while Oct 9, 2025
30dea3a
testing
go-while Oct 9, 2025
afa9db6
takethis conn mutex
go-while Oct 9, 2025
4c3885e
cherry-pick: updateNewsgroupsExpiryFromFile
go-while Oct 10, 2025
5c3c145
debugs
go-while Oct 10, 2025
fc826a0
debugs
go-while Oct 10, 2025
edb2992
AI did it! => testing
go-while Oct 10, 2025
3db753d
ai ai ai
go-while Oct 11, 2025
5ee2002
testing
go-while Oct 12, 2025
ccde975
cherry-pick: scan-out-of-order-overview
go-while Oct 12, 2025
5c88ddd
Update FuncStructList.txt
go-while Oct 12, 2025
db99aaa
debugs
go-while Oct 12, 2025
3fe900e
testing
go-while Oct 12, 2025
5243b70
testing
go-while Oct 12, 2025
a4ebec3
yayaya TNT
go-while Oct 12, 2025
c2e5276
testing
go-while Oct 12, 2025
c0b0756
testing
go-while Oct 12, 2025
63098f9
cherry-pick: disableNewsgroupsNotInActiveFile
go-while Oct 12, 2025
a010758
testing
go-while Oct 12, 2025
5bbe0e0
testing
go-while Oct 13, 2025
e258e80
testing
go-while Oct 13, 2025
bf1ce32
testing
go-while Oct 13, 2025
13ae93a
testing
go-while Oct 13, 2025
84dc35a
testing
go-while Oct 14, 2025
2d51bff
testing
go-while Oct 14, 2025
65527cb
go1.25.3
go-while Oct 14, 2025
3549a37
v0.4.7.4
go-while Oct 14, 2025
528f485
Update common.go
go-while Oct 14, 2025
8c26054
Update headers.go
go-while Oct 14, 2025
68ae061
Merge branch 'testing-001' into testing-002
go-while Oct 14, 2025
bd422a4
Update nntp-backend-pool.go
go-while Oct 14, 2025
f6d9146
Merge branch 'testing-002' of ssh://github.com/go-while/go-pugleaf in…
go-while Oct 14, 2025
ddea505
testing
go-while Oct 16, 2025
80ae796
testing
go-while Oct 16, 2025
117d748
testing
go-while Oct 19, 2025
8bbbd62
testing
go-while Oct 19, 2025
fa41c49
testing
go-while Oct 20, 2025
f523be2
testing
go-while Oct 20, 2025
6ae06dd
testing
go-while Oct 20, 2025
87a0af1
testing
go-while Oct 20, 2025
291ad01
testing
go-while Oct 20, 2025
e0a15fe
testing
go-while Oct 21, 2025
b5cb379
testing
go-while Oct 22, 2025
33f5fec
testing
go-while Oct 22, 2025
e832d5b
testing
go-while Oct 24, 2025
661070e
testing
go-while Oct 25, 2025
3d6a0a2
testing
go-while Oct 25, 2025
0d0dd46
testing
go-while Oct 25, 2025
8a4dda0
testing
go-while Oct 26, 2025
2e57ad9
testing
go-while Oct 26, 2025
aaedba9
testing
go-while Oct 26, 2025
29b9468
testing
go-while Oct 26, 2025
9d16cd9
testing
go-while Oct 26, 2025
75ad1dc
testing
go-while Oct 26, 2025
ff8f95e
testing
go-while Oct 26, 2025
22b2d98
testing
go-while Oct 26, 2025
11acfe0
testing
go-while Oct 27, 2025
64c209a
testing
go-while Oct 27, 2025
97e5a8d
testing
go-while Oct 27, 2025
b36039b
testing
go-while Oct 28, 2025
ca58ee7
Update db_migrate.go
go-while Oct 28, 2025
0a452b3
testing
go-while Oct 28, 2025
9f66ccd
testing
go-while Oct 28, 2025
fb0c9a7
prepare nntp-server history
go-while Nov 6, 2025
c7ec489
testing
go-while Nov 6, 2025
4321df5
testing
go-while Nov 7, 2025
354ae25
testing
go-while Nov 14, 2025
7ae2cfb
testing
go-while Nov 14, 2025
126a27f
testing
go-while Nov 14, 2025
a1a8918
testing
go-while Nov 14, 2025
63dd84d
testing
go-while Nov 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25.x'
go-version: '1.25.3'

- name: Install dependencies
run: go mod download
Expand Down
442 changes: 239 additions & 203 deletions FuncStructList.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion appVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.7.3
4.7.4
38 changes: 19 additions & 19 deletions cmd/expire-news/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,11 @@ func getNewsgroupsToExpire(db *database.Database, targetGroup string) ([]*models
// expireArticlesInGroup expires articles older than cutoffDate in the specified group
func expireArticlesInGroup(db *database.Database, groupName string, cutoffDate time.Time, batchSize int, dryRun bool) (int, int, error) {
// Get group database
groupDBs, err := db.GetGroupDBs(groupName)
groupDB, err := db.GetGroupDB(groupName)
if err != nil {
return 0, 0, fmt.Errorf("failed to get group database: %v", err)
}
defer groupDBs.Return(db)
defer groupDB.Return()

totalExpired := 0
totalScanned := 0
Expand All @@ -324,7 +324,7 @@ func expireArticlesInGroup(db *database.Database, groupName string, cutoffDate t
offset := 0
for {
// Get batch of articles
articles, err := getArticleBatch(groupDBs, offset, batchSize)
articles, err := getArticleBatch(groupDB, offset, batchSize)
if err != nil {
return totalExpired, totalScanned, fmt.Errorf("failed to get article batch: %v", err)
}
Expand Down Expand Up @@ -357,7 +357,7 @@ func expireArticlesInGroup(db *database.Database, groupName string, cutoffDate t

// Delete articles in this batch if not dry run
if !dryRun && len(articlesToDelete) > 0 {
if err := deleteArticles(groupDBs, articlesToDelete); err != nil {
if err := deleteArticles(groupDB, articlesToDelete); err != nil {
return totalExpired, totalScanned, fmt.Errorf("failed to delete articles: %v", err)
}
}
Expand All @@ -380,15 +380,15 @@ func expireArticlesInGroup(db *database.Database, groupName string, cutoffDate t
}

// getArticleBatch retrieves a batch of articles from the group database
func getArticleBatch(groupDBs *database.GroupDBs, offset, limit int) ([]*models.Article, error) {
func getArticleBatch(groupDB *database.GroupDB, offset, limit int) ([]*models.Article, error) {
query := `
SELECT article_num, date_sent
FROM articles
ORDER BY article_num
LIMIT ? OFFSET ?
`

rows, err := database.RetryableQuery(groupDBs.DB, query, limit, offset)
rows, err := database.RetryableQuery(groupDB.DB, query, limit, offset)
if err != nil {
return nil, err
}
Expand All @@ -398,8 +398,8 @@ func getArticleBatch(groupDBs *database.GroupDBs, offset, limit int) ([]*models.
for rows.Next() {
article := &models.Article{}
article.ArticleNums = make(map[*string]int64)
article.ArticleNums[groupDBs.NewsgroupPtr] = -1 // Initialize with group name
err := rows.Scan(article.ArticleNums[groupDBs.NewsgroupPtr], &article.DateSent)
article.ArticleNums[groupDB.NewsgroupPtr] = -1 // Initialize with group name
err := rows.Scan(article.ArticleNums[groupDB.NewsgroupPtr], &article.DateSent)
if err != nil {
return nil, err
}
Expand All @@ -410,13 +410,13 @@ func getArticleBatch(groupDBs *database.GroupDBs, offset, limit int) ([]*models.
}

// deleteArticles removes articles from the database using proper batch operations
func deleteArticles(groupDBs *database.GroupDBs, articleNums []int64) error {
func deleteArticles(groupDB *database.GroupDB, articleNums []int64) error {
if len(articleNums) == 0 {
return nil
}

// Begin transaction
tx, err := groupDBs.DB.Begin()
tx, err := groupDB.DB.Begin()
if err != nil {
return err
}
Expand Down Expand Up @@ -495,15 +495,15 @@ func getPlaceholders(count int) string {
// pruneArticlesInGroup removes oldest articles to keep the group under maxArticles limit
func pruneArticlesInGroup(db *database.Database, groupName string, maxArticles int, batchSize int, dryRun bool) (int, int, error) {
// Get group database
groupDBs, err := db.GetGroupDBs(groupName)
groupDB, err := db.GetGroupDB(groupName)
if err != nil {
return 0, 0, fmt.Errorf("failed to get group database: %v", err)
}
defer groupDBs.Return(db)
defer groupDB.Return()

// First count total articles
var totalArticles int
err = database.RetryableQueryRowScan(groupDBs.DB, "SELECT COUNT(*) FROM articles", nil, &totalArticles)
err = database.RetryableQueryRowScan(groupDB.DB, "SELECT COUNT(*) FROM articles", nil, &totalArticles)
if err != nil {
return 0, 0, fmt.Errorf("failed to count articles: %v", err)
}
Expand All @@ -525,7 +525,7 @@ func pruneArticlesInGroup(db *database.Database, groupName string, maxArticles i
LIMIT ?
`

rows, err := database.RetryableQuery(groupDBs.DB, query, articlesToRemove)
rows, err := database.RetryableQuery(groupDB.DB, query, articlesToRemove)
if err != nil {
return 0, totalArticles, fmt.Errorf("failed to query oldest articles: %v", err)
}
Expand Down Expand Up @@ -556,7 +556,7 @@ func pruneArticlesInGroup(db *database.Database, groupName string, maxArticles i
}

batch := articlesToDelete[i:end]
if err := deleteArticles(groupDBs, batch); err != nil {
if err := deleteArticles(groupDB, batch); err != nil {
return totalPruned, totalArticles, fmt.Errorf("failed to delete article batch: %v", err)
}

Expand All @@ -577,22 +577,22 @@ func pruneArticlesInGroup(db *database.Database, groupName string, maxArticles i
// updateNewsgroupCounters updates the message count and last article number for a newsgroup
func updateNewsgroupCounters(db *database.Database, groupName string) error {
// Get group database to count current articles
groupDBs, err := db.GetGroupDBs(groupName)
groupDB, err := db.GetGroupDB(groupName)
if err != nil {
return fmt.Errorf("failed to get group database: %v", err)
}
defer groupDBs.Return(db)
defer groupDB.Return()

// Count current articles
var messageCount int64
err = database.RetryableQueryRowScan(groupDBs.DB, "SELECT COUNT(*) FROM articles", nil, &messageCount)
err = database.RetryableQueryRowScan(groupDB.DB, "SELECT COUNT(*) FROM articles", nil, &messageCount)
if err != nil {
return fmt.Errorf("failed to count articles: %v", err)
}

// Get the highest article number
var lastArticle int64
err = database.RetryableQueryRowScan(groupDBs.DB, "SELECT COALESCE(MAX(article_num), 0) FROM articles", nil, &lastArticle)
err = database.RetryableQueryRowScan(groupDB.DB, "SELECT COALESCE(MAX(article_num), 0) FROM articles", nil, &lastArticle)
if err != nil {
return fmt.Errorf("failed to get last article: %v", err)
}
Expand Down
14 changes: 7 additions & 7 deletions cmd/fix-references/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func main() {
for i, newsgroup := range newsgroups {
fmt.Printf("🔍 [%d/%d] Processing newsgroup: %s\n", i+1, len(newsgroups), newsgroup.Name)

groupDB, err := db.GetGroupDBs(newsgroup.Name)
groupDB, err := db.GetGroupDB(newsgroup.Name)
if err != nil {
fmt.Printf(" ❌ Failed to get group database: %v\n", err)
continue
Expand All @@ -138,7 +138,7 @@ func main() {
processed, fixed, err := fixReferencesInNewsgroup(groupDB, *dryRun, *verbose, *limit, *batchSize)
if err != nil {
fmt.Printf(" ❌ Failed to fix references: %v\n", err)
groupDB.Return(db)
groupDB.Return()
continue
}

Expand All @@ -156,7 +156,7 @@ func main() {
}
}

groupDB.Return(db)
groupDB.Return()

if processed > 0 {
if fixed > 0 {
Expand Down Expand Up @@ -186,7 +186,7 @@ func main() {
}
}

func fixReferencesInNewsgroup(groupDB *database.GroupDBs, dryRun, verbose bool, limit, batchSize int) (int, int, error) {
func fixReferencesInNewsgroup(groupDB *database.GroupDB, dryRun, verbose bool, limit, batchSize int) (int, int, error) {
// Get total count for progress tracking
var totalCount int
countQuery := "SELECT COUNT(*) FROM articles WHERE headers_json IS NOT NULL AND headers_json != ''"
Expand Down Expand Up @@ -234,7 +234,7 @@ func fixReferencesInNewsgroup(groupDB *database.GroupDBs, dryRun, verbose bool,
return totalProcessed, totalFixed, nil
}

func processBatch(groupDB *database.GroupDBs, dryRun, verbose bool, offset, batchSize int) (int, int, error) {
func processBatch(groupDB *database.GroupDB, dryRun, verbose bool, offset, batchSize int) (int, int, error) {
// Query articles with potentially broken references
query := `
SELECT article_num, message_id, "references", headers_json
Expand Down Expand Up @@ -320,7 +320,7 @@ func processBatch(groupDB *database.GroupDBs, dryRun, verbose bool, offset, batc
}

// rebuildThreadsInNewsgroup rebuilds thread relationships for a newsgroup using batched processing
func rebuildThreadsInNewsgroup(groupDB *database.GroupDBs, verbose bool, batchSize int) (int, error) {
func rebuildThreadsInNewsgroup(groupDB *database.GroupDB, verbose bool, batchSize int) (int, error) {
// Get total article count
var totalCount int
err := database.RetryableQueryRowScan(groupDB.DB, "SELECT COUNT(*) FROM articles", nil, &totalCount)
Expand Down Expand Up @@ -419,7 +419,7 @@ func rebuildThreadsInNewsgroup(groupDB *database.GroupDBs, verbose bool, batchSi
return totalThreadsBuilt, nil
}

func processThreadBatch(groupDB *database.GroupDBs, msgIDToArticleNum map[string]int64, offset, batchSize int, verbose bool) (int, error) {
func processThreadBatch(groupDB *database.GroupDB, msgIDToArticleNum map[string]int64, offset, batchSize int, verbose bool) (int, error) {
// Get batch of articles with their references
rows, err := database.RetryableQuery(groupDB.DB, `
SELECT article_num, message_id, "references"
Expand Down
10 changes: 5 additions & 5 deletions cmd/fix-thread-activity/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ func main() {
}

func fixGroupThreadActivity(db *database.Database, groupName string) error {
groupDBs, err := db.GetGroupDBs(groupName)
groupDB, err := db.GetGroupDB(groupName)
if err != nil {
return fmt.Errorf("failed to get group DB: %w", err)
}
defer groupDBs.Return(db)
defer groupDB.Return()

// Get only thread cache entries that have future last_activity timestamps
rows, err := database.RetryableQuery(groupDBs.DB, `
rows, err := database.RetryableQuery(groupDB.DB, `
SELECT thread_root, child_articles, last_activity
FROM thread_cache
WHERE last_activity > datetime('now', '+25 hour')
Expand Down Expand Up @@ -136,7 +136,7 @@ func fixGroupThreadActivity(db *database.Database, groupName string) error {
for _, articleNum := range articleNums {
var dateSent time.Time
var hide int
err := database.RetryableQueryRowScan(groupDBs.DB, `
err := database.RetryableQueryRowScan(groupDB.DB, `
SELECT date_sent, hide
FROM articles
WHERE article_num = ?`, []interface{}{articleNum}, &dateSent, &hide)
Expand All @@ -161,7 +161,7 @@ func fixGroupThreadActivity(db *database.Database, groupName string) error {
// Format as UTC string to avoid timezone encoding issues
utcTimeStr := maxDate.UTC().Format("2006-01-02 15:04:05")

_, err := database.RetryableExec(groupDBs.DB, `
_, err := database.RetryableExec(groupDB.DB, `
UPDATE thread_cache
SET last_activity = ?
WHERE thread_root = ?`, utcTimeStr, thread.root)
Expand Down
Loading