diff options
| author | Jonas Knobloch <jonas.knobloch@t-online.de> | 2026-06-07 20:26:59 +0200 |
|---|---|---|
| committer | Jonas Knobloch <jonas.knobloch@t-online.de> | 2026-06-07 20:26:59 +0200 |
| commit | 7ae0651a55ace3c5d1f651775c1160f6e0b72152 (patch) | |
| tree | 577d906ae8f9c94ca6e435469db19dcbb12f2943 /research/lesci/context.go | |
| parent | 027bce960feaec195b633b6195c9ff5cbb9f43f9 (diff) | |
Add config to lesci experiment
Diffstat (limited to 'research/lesci/context.go')
| -rw-r--r-- | research/lesci/context.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/research/lesci/context.go b/research/lesci/context.go index df9b059..8496507 100644 --- a/research/lesci/context.go +++ b/research/lesci/context.go @@ -1,6 +1,7 @@ package lesci import ( + "context" "database/sql" "database/sql/driver" "fmt" @@ -39,7 +40,17 @@ func (e *Experiment) BuildContext(db *sql.DB) error { } else if !ok { fmt.Println("context table not empty") - return nil + if !e.options.ForceContext { + fmt.Println("skipping context collection") + + return nil + } + + fmt.Println("clearing context") + + if _, err := db.ExecContext(context.Background(), `DELETE FROM context`); err != nil { + return err + } } return AppendRows(db, "context", func(append AppendFunc) error { |
