remove stopwatches + logs

This commit is contained in:
Pascal Fischer
2024-04-29 16:26:44 +02:00
parent 02537e5536
commit 2095e35217
3 changed files with 0 additions and 39 deletions

View File

@@ -541,12 +541,6 @@ func (am *DefaultAccountManager) SyncPeer(sync PeerSync, account *Account) (*nbp
// LoginPeer logs in or registers a peer.
// If peer doesn't exist the function checks whether a setup key or a user is present and registers a new peer if so.
func (am *DefaultAccountManager) LoginPeer(login PeerLogin) (*nbpeer.Peer, *NetworkMap, error) {
startTime := time.Now()
defer func() {
duration := time.Since(startTime)
log.Debugf("LoginPeer took %s", duration)
}()
account, err := am.Store.GetAccountByPeerPubKey(login.WireGuardPubKey)
if err != nil {
if errStatus, ok := status.FromError(err); ok && errStatus.Type() == status.NotFound {

View File

@@ -5,8 +5,6 @@ import (
"net"
"net/netip"
"time"
log "github.com/sirupsen/logrus"
)
// Peer represents a machine connected to the network.
@@ -175,8 +173,6 @@ func (p *Peer) UpdateMetaIfNew(meta PeerSystemMeta) bool {
meta.UIVersion = p.Meta.UIVersion
}
log.Infof("Check if meta is equal: %v", p.Meta.isEqual(meta))
if p.Meta.isEqual(meta) {
return false
}

View File

@@ -479,12 +479,6 @@ func (s *SqliteStore) GetAccount(accountID string) (*Account, error) {
}
func (s *SqliteStore) GetAccountByUser(userID string) (*Account, error) {
startTime := time.Now()
defer func() {
duration := time.Since(startTime)
log.Debugf("GetAccountByUser took %s", duration)
}()
var user User
result := s.db.Select("account_id").First(&user, "id = ?", userID)
if result.Error != nil {
@@ -503,11 +497,6 @@ func (s *SqliteStore) GetAccountByUser(userID string) (*Account, error) {
}
func (s *SqliteStore) GetAccountByPeerID(peerID string) (*Account, error) {
startTime := time.Now()
defer func() {
duration := time.Since(startTime)
log.Debugf("GetAccountByPeerID took %s", duration)
}()
var peer nbpeer.Peer
result := s.db.Select("account_id").First(&peer, "id = ?", peerID)
if result.Error != nil {
@@ -526,12 +515,6 @@ func (s *SqliteStore) GetAccountByPeerID(peerID string) (*Account, error) {
}
func (s *SqliteStore) GetAccountByPeerPubKey(peerKey string) (*Account, error) {
startTime := time.Now()
defer func() {
duration := time.Since(startTime)
log.Debugf("GetAccountByPubKey took %s", duration)
}()
var peer nbpeer.Peer
result := s.db.Select("account_id").First(&peer, "key = ?", peerKey)
@@ -551,12 +534,6 @@ func (s *SqliteStore) GetAccountByPeerPubKey(peerKey string) (*Account, error) {
}
func (s *SqliteStore) GetAccountIDByPeerPubKey(peerKey string) (string, error) {
startTime := time.Now()
defer func() {
duration := time.Since(startTime)
log.Debugf("GetAccountByPubKey took %s", duration)
}()
var peer nbpeer.Peer
var accountID string
result := s.db.Model(&peer).Select("account_id").Where("key = ?", peerKey).First(&accountID)
@@ -573,12 +550,6 @@ func (s *SqliteStore) GetAccountIDByPeerPubKey(peerKey string) (string, error) {
// SaveUserLastLogin stores the last login time for a user in DB.
func (s *SqliteStore) SaveUserLastLogin(accountID, userID string, lastLogin time.Time) error {
startTime := time.Now()
defer func() {
duration := time.Since(startTime)
log.Debugf("SaveUserLastLogin took %s", duration)
}()
var user User
result := s.db.First(&user, "account_id = ? and id = ?", accountID, userID)