aboutsummaryrefslogtreecommitdiffstats
path: root/tools/syz-lore
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-04-12 11:17:35 +0200
committerAleksandr Nogikh <wp32pw@gmail.com>2023-04-12 13:55:59 +0200
commit5d17667bb6ecde104eff665d3c096ac2b7984648 (patch)
tree6915c7b58d1d19ab402d78f8fec6878d51cf074e /tools/syz-lore
parent02abcd096cbcce690366f853c8bc065d22aa205c (diff)
all: refactor discussion processing code
Now that too much logic seems to be duplicated in tools/syz-lore and dahsboard/app/discussion.go, it's time to refactor the code. Factor out the code that decides whether an incoming email message should start a new thread or be appended to the previous one. Restructure pkg/email/lore so that email processing matches the one-by-one approach of reporting_email.go.
Diffstat (limited to 'tools/syz-lore')
-rw-r--r--tools/syz-lore/query_lkml.go12
1 files changed, 3 insertions, 9 deletions
diff --git a/tools/syz-lore/query_lkml.go b/tools/syz-lore/query_lkml.go
index fed69eede..324dee7be 100644
--- a/tools/syz-lore/query_lkml.go
+++ b/tools/syz-lore/query_lkml.go
@@ -56,18 +56,12 @@ func main() {
Time: m.Date,
})
}
- discType := dashapi.DiscussionReport
- if strings.Contains(thread.Subject, "PATCH") {
- discType = dashapi.DiscussionPatch
- } else if strings.Contains(thread.Subject, "Monthly") {
- discType = dashapi.DiscussionReminder
- }
log.Printf("saving %d/%d", i+1, len(threads))
err := dash.SaveDiscussion(&dashapi.SaveDiscussionReq{
Discussion: &dashapi.Discussion{
ID: thread.MessageID,
Source: dashapi.DiscussionLore,
- Type: discType,
+ Type: thread.Type,
Subject: thread.Subject,
BugIDs: thread.BugIDs,
Messages: messages,
@@ -146,8 +140,8 @@ func processArchives(dir string, emails, domains []string) []*lore.Thread {
}
ret = append(ret, d)
if *flagVerbose {
- log.Printf("discussion ID=%s BugID=%s Subject=%s Messages=%d",
- d.MessageID, d.BugIDs, d.Subject, len(d.Messages))
+ log.Printf("discussion ID=%s BugID=%s Type=%s Subject=%s Messages=%d",
+ d.MessageID, d.BugIDs, d.Subject, d.Type, len(d.Messages))
}
}
log.Printf("%d threads are related to syzbot", len(ret))