@@ -37,6 +37,7 @@ func main() {
37
37
checkConnectSettings ()
38
38
39
39
// The main process of getting data from GitHub API and store it into MySQL, PostgreSQL, MongoDB databases.
40
+
40
41
fetchGitHubData (app .Config )
41
42
42
43
// Delay before the next start (Defined by the DELAY_MINUTES parameter)
@@ -88,6 +89,13 @@ func checkConnectSettings() {
88
89
89
90
func fetchGitHubData (envVars app.EnvVars ) {
90
91
92
+ if envVars .Postgres .ConnectionStatus != "Connected" &&
93
+ envVars .MySQL .ConnectionStatus != "Connected" &&
94
+ envVars .MongoDB .ConnectionStatus != "Connected" {
95
+ log .Printf ("Error: No database connections are established." )
96
+ return
97
+ }
98
+
91
99
report := helperReportStart ()
92
100
93
101
// Get all the repositories of the organization.
@@ -612,35 +620,6 @@ func MongoDBprocessPulls(envVars app.EnvVars, allRepos []*github.Repository, all
612
620
613
621
log .Printf ("Databases: MongoDB: Start" )
614
622
615
- admin_db := client .Database ("admin" ) // используем базу данных admin
616
-
617
- // Check and set profiling level
618
- var profilingLevel bson.M
619
- err = admin_db .RunCommand (ctx , bson.D {{Key : "profile" , Value : - 1 }}).Decode (& profilingLevel )
620
- if err != nil {
621
- log .Printf ("MongoDB: Get Profiling Level Error: %s" , err )
622
- return err
623
- }
624
-
625
- if profilingLevel ["was" ] == int32 (0 ) {
626
- err = admin_db .RunCommand (ctx , bson.D {{Key : "profile" , Value : 1 }}).Err ()
627
- if err != nil {
628
- log .Printf ("MongoDB: Set Profiling Level Error: %s" , err )
629
- return err
630
- }
631
- }
632
-
633
- // Set operation profiling
634
- err = admin_db .RunCommand (ctx , bson.D {
635
- {Key : "profile" , Value : 2 },
636
- {Key : "slowms" , Value : 200 },
637
- {Key : "sampleRate" , Value : 1.0 },
638
- }).Err ()
639
- if err != nil {
640
- log .Printf ("MongoDB: Set Operation Profiling Error: %s" , err )
641
- return err
642
- }
643
-
644
623
db := client .Database (envVars .MongoDB .DB )
645
624
dbCollectionRepos := db .Collection ("repositories" )
646
625
dbCollectionPulls := db .Collection ("pulls" )
0 commit comments