Skip to content

Commit 96b28e8

Browse files
committed
chore: more logging on version upload
1 parent f2cf2fe commit 96b28e8

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

gql/resolver_versions.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ func (r *mutationResolver) FinalizeCreateVersion(ctx context.Context, modID stri
100100
return false, errors.New("you must update your mod reference on the site to match your mod_reference in your data.json")
101101
}
102102

103+
log.Ctx(ctx).Info().Str("mod_id", mod.ID).Str("version_id", versionID).Msg("finalization gql call")
104+
103105
go func(ctx context.Context, mod *postgres.Mod, versionID string, version generated.NewVersion) {
104106
defer func() {
105107
if r := recover(); r != nil {
@@ -111,12 +113,16 @@ func (r *mutationResolver) FinalizeCreateVersion(ctx context.Context, modID stri
111113
}
112114
}()
113115

116+
log.Ctx(ctx).Info().Str("mod_id", mod.ID).Str("version_id", versionID).Msg("calling FinalizeVersionUploadAsync")
117+
114118
data, err := FinalizeVersionUploadAsync(ctx, mod, versionID, version)
115119
if err2 := redis.StoreVersionUploadState(versionID, data, err); err2 != nil {
116120
log.Ctx(ctx).Err(err2).Msg("error storing redis state")
117121
return
118122
}
119123

124+
log.Ctx(ctx).Info().Str("mod_id", mod.ID).Str("version_id", versionID).Msg("finished FinalizeVersionUploadAsync")
125+
120126
if err != nil {
121127
log.Ctx(ctx).Err(err).Msgf("error completing version upload [%s]", versionID)
122128
} else {

gql/versions.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ import (
2020
)
2121

2222
func FinalizeVersionUploadAsync(ctx context.Context, mod *postgres.Mod, versionID string, version generated.NewVersion) (*generated.CreateVersionResponse, error) {
23+
l := log.With().Str("mod_id", mod.ID).Str("version_id", versionID).Logger()
24+
25+
l.Info().Msg("Creating multipart upload")
2326
success, _ := storage.CompleteUploadMultipartMod(ctx, mod.ID, mod.Name, versionID)
2427

2528
if !success {
@@ -163,6 +166,7 @@ func FinalizeVersionUploadAsync(ctx context.Context, mod *postgres.Mod, versionI
163166

164167
go integrations.NewVersion(util.ReWrapCtx(ctx), dbVersion)
165168
} else {
169+
l.Info().Msg("Submitting version job for virus scan")
166170
jobs.SubmitJobScanModOnVirusTotalTask(ctx, mod.ID, dbVersion.ID, true)
167171
}
168172

integrations/discord.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"io"
99
"io/ioutil"
1010
"net/http"
11+
"runtime/debug"
1112
"strings"
1213

1314
"github.com/satisfactorymodding/smr-api/db/postgres"
@@ -79,6 +80,8 @@ func NewMod(ctx context.Context, mod *postgres.Mod) {
7980
}
8081

8182
func NewVersion(ctx context.Context, version *postgres.Version) {
83+
log.Ctx(ctx).Info().Str("stack", string(debug.Stack())).Msg("new version discord webhook")
84+
8285
if version == nil {
8386
return
8487
}

0 commit comments

Comments
 (0)