Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert migration #47

Merged
merged 4 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- master
- dev
- db-migration

env:
REGISTRY: ghcr.io
Expand Down
17 changes: 3 additions & 14 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"airdao-mobile-api/pkg/logger"
"airdao-mobile-api/pkg/mongodb"
"airdao-mobile-api/services/health"
"airdao-mobile-api/services/migration"
"airdao-mobile-api/services/watcher"
"context"
"errors"
Expand Down Expand Up @@ -58,11 +57,6 @@ func main() {
}
zapLogger.Info("DB connected successfully")

err = migration.RunMigrations(db, cfg.MongoDb.MongoDbName, zapLogger)
if err != nil {
zapLogger.Fatalf("failed to run migration: %s", err)
}

// Firebase
firebaseClient, err := firebase.NewClient(cfg.Firebase.CredPath)
if err != nil {
Expand Down Expand Up @@ -109,25 +103,20 @@ func main() {
ServerHeader: "AIRDAO-Mobile-Api", // add custom server header
}

zapLogger.Info("Deleting watchers with stale data...")

// Run DeleteWatchersWithStaleData on start for check and delete stale data
if err := watcherService.DeleteWatchersWithStaleData(context.Background()); err != nil {
zapLogger.Errorf("failed to delete watchers with stale data - %v", err)
}

zapLogger.Info("Deleted watchers with stale data successfully")

// Run DeleteWatchersWithStaleData every 24 hours for check and delete stale data
go func() {
for {
time.Sleep(24 * time.Hour)

err := watcherService.DeleteWatchersWithStaleData(context.Background())
if err != nil {
zapLogger.Errorf("failed to delete watchers with stale data - %v", err)
}
zapLogger.Info("Deleted watchers with stale data successfully")

time.Sleep(24 * time.Hour)
}
}()

Expand Down Expand Up @@ -160,7 +149,7 @@ func main() {
}
}()

zapLogger.Infoln("Server started on port", cfg.Port)
zapLogger.Infoln("Server started on port %v", cfg.Port)

// Create a context that will be used to gracefully shut down the server
ctx, cancel = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
Expand Down
124 changes: 0 additions & 124 deletions services/migration/migration.go

This file was deleted.

Loading
Loading