Changeset 652 in code for trunk/service.go


Ignore:
Timestamp:
Oct 18, 2021, 5:15:15 PM (4 years ago)
Author:
contact
Message:

Add context args to Database interface

This is a mecanical change, which just lifts up the context.TODO()
calls from inside the DB implementations to the callers.

Future work involves properly wiring up the contexts when it makes
sense.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/service.go

    r625 r652  
    22
    33import (
     4        "context"
    45        "crypto/sha1"
    56        "crypto/sha256"
     
    658659        net.SASL.Mechanism = "EXTERNAL"
    659660
    660         if err := dc.srv.db.StoreNetwork(dc.user.ID, &net.Network); err != nil {
     661        if err := dc.srv.db.StoreNetwork(context.TODO(), dc.user.ID, &net.Network); err != nil {
    661662                return err
    662663        }
     
    699700        net.SASL.Mechanism = "PLAIN"
    700701
    701         if err := dc.srv.db.StoreNetwork(dc.user.ID, &net.Network); err != nil {
     702        if err := dc.srv.db.StoreNetwork(context.TODO(), dc.user.ID, &net.Network); err != nil {
    702703                return err
    703704        }
     
    723724        net.SASL.Mechanism = ""
    724725
    725         if err := dc.srv.db.StoreNetwork(dc.user.ID, &net.Network); err != nil {
     726        if err := dc.srv.db.StoreNetwork(context.TODO(), dc.user.ID, &net.Network); err != nil {
    726727                return err
    727728        }
     
    861862        u.stop()
    862863
    863         if err := dc.srv.db.DeleteUser(u.ID); err != nil {
     864        if err := dc.srv.db.DeleteUser(context.TODO(), u.ID); err != nil {
    864865                return fmt.Errorf("failed to delete user: %v", err)
    865866        }
     
    10161017        uc.updateChannelAutoDetach(upstreamName)
    10171018
    1018         if err := dc.srv.db.StoreChannel(uc.network.ID, ch); err != nil {
     1019        if err := dc.srv.db.StoreChannel(context.TODO(), uc.network.ID, ch); err != nil {
    10191020                return fmt.Errorf("failed to update channel: %v", err)
    10201021        }
     
    10251026
    10261027func handleServiceServerStatus(dc *downstreamConn, params []string) error {
    1027         dbStats, err := dc.user.srv.db.Stats()
     1028        dbStats, err := dc.user.srv.db.Stats(context.TODO())
    10281029        if err != nil {
    10291030                return err
Note: See TracChangeset for help on using the changeset viewer.