Skip to content
This repository was archived by the owner on Aug 10, 2021. It is now read-only.

Commit

Permalink
globClient viga kõrvaldatud
Browse files Browse the repository at this point in the history
  • Loading branch information
Priit Parmakson committed Mar 5, 2019
1 parent 546fe7c commit 3b7458f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion docs/TARA-Stat.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Kaustastruktuur
- ` scripts` - paigaldusskriptid
- ` docs` - avalik dokumentatsioon

- `/opt/tara-stat/log.txt` -- TARA-Stat veebirakenduse logi
- `/opt/tara-stat/tara-stat/log.txt` -- TARA-Stat veebirakenduse logi
- `/lib/systemd/system/tarastat.service` -- TARA-Stat veebirakenduse systemd haldusüksuse kirjeldusfail

- `/etc/mongod.conf` -- MongoDB konf-ifail
Expand Down Expand Up @@ -306,6 +306,8 @@ Probleemide lahendamiseks saab kasutada teenuse enda logisid (vt jaotis "Olulise

`sudo journalctl -u tarastat` (`tarastat` koondlogi vaatamine vahendiga `journalctl`)

`tail /opt/tara-stat/tara-stat/log.txt` -- TARA-Stat veebirakenduse logi

`tail /var/log/mongodb/mongod.log` (andmebaasisüsteemi logi)

### 2.6 Logibaasi haldamine
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var config = require('/opt/tara-stat/config/config.js');
// -------- 3 Globaalsed muutujad --------
// MongoDB klient. Operatsioon "connection" teeb MongoClient uue
// instantsi, mis omistatakse allolevale muutujale.
var globClient = MongoClient;
var globClient;
// Ühendus MongoDB andmebaasiga "logibaas". Deklareeritud siin,
// et oleks elutukse väljastajas kättesaadav.
var db;
Expand Down Expand Up @@ -336,12 +336,12 @@ app.get('/status', function (req, res) {
async function looYhendus() {
try {
if (globClient && globClient.isConnected()) {
// console.log('Ühendus olemas');
console.log('Ühendus olemas');
return;
}
var klient = await MongoClient.connect(MONGODB_URL,
{ useNewUrlParser: true });
// console.log('Ühendus loodud');
console.log('Ühendus loodud');
globClient = klient;
db = klient.db('logibaas');
}
Expand Down

0 comments on commit 3b7458f

Please sign in to comment.