nandi/gleanpublic Fork 0
4c84177
Commits
Clone
git clone https://git.rickub.com/nandi/glean.git
git clone ssh://git@rickub.com/nandi/glean.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Temorarily disable user action in cluster (recommendation system)Unverified

Julien Robert committed 2026-04-26T00:04:43+02:00 Browse files
4c84177 parent: 76c617b
modified internal/cluster/dismiss.go +4 -0
@@ -11,6 +11,7 @@ type Impression struct {
1111 }
1212
1313 func (e *Engine) DismissFeed(ctx context.Context, userDID, feedURL, reason string) error {
14+ return nil
1415 _, err := e.db.ExecContext(ctx, `
1516 INSERT INTO recs.dismissed_recommendations (user_did, target_type, target_id, reason)
1617 VALUES (?, 'feed', ?, ?)
@@ -20,6 +21,7 @@ func (e *Engine) DismissFeed(ctx context.Context, userDID, feedURL, reason strin
2021 }
2122
2223 func (e *Engine) DismissArticle(ctx context.Context, userDID, articleURL, reason string) error {
24+ return nil
2325 _, err := e.db.ExecContext(ctx, `
2426 INSERT INTO recs.dismissed_recommendations (user_did, target_type, target_id, reason)
2527 VALUES (?, 'article', ?, ?)
@@ -29,6 +31,7 @@ func (e *Engine) DismissArticle(ctx context.Context, userDID, articleURL, reason
2931 }
3032
3133 func (e *Engine) RecordImpressions(ctx context.Context, userDID string, impressions []Impression) error {
34+ return nil
3235 tx, err := e.db.BeginTx(ctx, nil)
3336 if err != nil {
3437 return err
@@ -51,6 +54,7 @@ func (e *Engine) RecordImpressions(ctx context.Context, userDID string, impressi
5154 }
5255
5356 func (e *Engine) MarkImpressionActed(ctx context.Context, userDID, targetType, targetID string) error {
57+ return nil
5458 _, err := e.db.ExecContext(ctx, `
5559 UPDATE recs.recommendation_impressions SET acted = 1
5660 WHERE user_did = ? AND target_type = ? AND target_id = ?
@@ -11,6 +11,7 @@ type Impression struct {
11 }11 }
12 12
13 func (e *Engine) DismissFeed(ctx context.Context, userDID, feedURL, reason string) error {13 func (e *Engine) DismissFeed(ctx context.Context, userDID, feedURL, reason string) error {
14+ return nil
14 _, err := e.db.ExecContext(ctx, `15 _, err := e.db.ExecContext(ctx, `
15 INSERT INTO recs.dismissed_recommendations (user_did, target_type, target_id, reason)16 INSERT INTO recs.dismissed_recommendations (user_did, target_type, target_id, reason)
16 VALUES (?, 'feed', ?, ?)17 VALUES (?, 'feed', ?, ?)
@@ -20,6 +21,7 @@ func (e *Engine) DismissFeed(ctx context.Context, userDID, feedURL, reason strin
20 }21 }
21 22
22 func (e *Engine) DismissArticle(ctx context.Context, userDID, articleURL, reason string) error {23 func (e *Engine) DismissArticle(ctx context.Context, userDID, articleURL, reason string) error {
24+ return nil
23 _, err := e.db.ExecContext(ctx, `25 _, err := e.db.ExecContext(ctx, `
24 INSERT INTO recs.dismissed_recommendations (user_did, target_type, target_id, reason)26 INSERT INTO recs.dismissed_recommendations (user_did, target_type, target_id, reason)
25 VALUES (?, 'article', ?, ?)27 VALUES (?, 'article', ?, ?)
@@ -29,6 +31,7 @@ func (e *Engine) DismissArticle(ctx context.Context, userDID, articleURL, reason
29 }31 }
30 32
31 func (e *Engine) RecordImpressions(ctx context.Context, userDID string, impressions []Impression) error {33 func (e *Engine) RecordImpressions(ctx context.Context, userDID string, impressions []Impression) error {
34+ return nil
32 tx, err := e.db.BeginTx(ctx, nil)35 tx, err := e.db.BeginTx(ctx, nil)
33 if err != nil {36 if err != nil {
34 return err37 return err
@@ -51,6 +54,7 @@ func (e *Engine) RecordImpressions(ctx context.Context, userDID string, impressi
51 }54 }
52 55
53 func (e *Engine) MarkImpressionActed(ctx context.Context, userDID, targetType, targetID string) error {56 func (e *Engine) MarkImpressionActed(ctx context.Context, userDID, targetType, targetID string) error {
57+ return nil
54 _, err := e.db.ExecContext(ctx, `58 _, err := e.db.ExecContext(ctx, `
55 UPDATE recs.recommendation_impressions SET acted = 159 UPDATE recs.recommendation_impressions SET acted = 1
56 WHERE user_did = ? AND target_type = ? AND target_id = ?60 WHERE user_did = ? AND target_type = ? AND target_id = ?
modified internal/cluster/weights.go +2 -0
@@ -12,10 +12,12 @@ const (
1212 )
1313
1414 func (e *Engine) RewardSignal(ctx context.Context, userDID string, signal string) {
15+ return
1516 e.adjustWeight(ctx, userDID, signal, 1.0)
1617 }
1718
1819 func (e *Engine) PenalizeSignal(ctx context.Context, userDID string, signal string) {
20+ return
1921 e.adjustWeight(ctx, userDID, signal, -1.0)
2022 }
2123
@@ -12,10 +12,12 @@ const (
12 )12 )
13 13
14 func (e *Engine) RewardSignal(ctx context.Context, userDID string, signal string) {14 func (e *Engine) RewardSignal(ctx context.Context, userDID string, signal string) {
15+ return
15 e.adjustWeight(ctx, userDID, signal, 1.0)16 e.adjustWeight(ctx, userDID, signal, 1.0)
16 }17 }
17 18
18 func (e *Engine) PenalizeSignal(ctx context.Context, userDID string, signal string) {19 func (e *Engine) PenalizeSignal(ctx context.Context, userDID string, signal string) {
20+ return
19 e.adjustWeight(ctx, userDID, signal, -1.0)21 e.adjustWeight(ctx, userDID, signal, -1.0)
20 }22 }
21 23