@@ -45,6 +45,7 @@ import (
4545 "github.com/btcsuite/btcutil/base58"
4646 "github.com/golang/protobuf/proto"
4747 "github.com/golang/protobuf/ptypes"
48+ ipfscore "github.com/ipfs/go-ipfs/core"
4849 "github.com/ipfs/go-ipfs/core/coreapi"
4950 "github.com/ipfs/go-ipfs/namesys"
5051 "github.com/ipfs/go-ipfs/repo/fsrepo"
@@ -916,7 +917,11 @@ func (i *jsonAPIHandler) POSTSettings(w http.ResponseWriter, r *http.Request) {
916917 }
917918 if settings .StoreModerators != nil {
918919 modsToAdd , modsToDelete := extractModeratorChanges (* settings .StoreModerators , nil )
919- go i .node .NotifyModerators (modsToAdd , modsToDelete )
920+ go func (modsToAdd , modsToDelete []string ) {
921+ if err := i .node .NotifyModerators (modsToAdd , modsToDelete ); err != nil {
922+ log .Error (err )
923+ }
924+ }(modsToAdd , modsToDelete )
920925 if err := i .node .SetModeratorsOnListings (* settings .StoreModerators ); err != nil {
921926 ErrorResponse (w , http .StatusInternalServerError , err .Error ())
922927 }
@@ -973,7 +978,11 @@ func (i *jsonAPIHandler) PUTSettings(w http.ResponseWriter, r *http.Request) {
973978 }
974979 if settings .StoreModerators != nil {
975980 modsToAdd , modsToDelete := extractModeratorChanges (* settings .StoreModerators , currentSettings .StoreModerators )
976- go i .node .NotifyModerators (modsToAdd , modsToDelete )
981+ go func (modsToAdd , modsToDelete []string ) {
982+ if err := i .node .NotifyModerators (modsToAdd , modsToDelete ); err != nil {
983+ log .Error (err )
984+ }
985+ }(modsToAdd , modsToDelete )
977986 if err := i .node .SetModeratorsOnListings (* settings .StoreModerators ); err != nil {
978987 ErrorResponse (w , http .StatusInternalServerError , err .Error ())
979988 }
@@ -1033,7 +1042,11 @@ func (i *jsonAPIHandler) PATCHSettings(w http.ResponseWriter, r *http.Request) {
10331042 }
10341043 if settings .StoreModerators != nil {
10351044 modsToAdd , modsToDelete := extractModeratorChanges (* settings .StoreModerators , currentSettings .StoreModerators )
1036- go i .node .NotifyModerators (modsToAdd , modsToDelete )
1045+ go func (modsToAdd , modsToDelete []string ) {
1046+ if err := i .node .NotifyModerators (modsToAdd , modsToDelete ); err != nil {
1047+ log .Error (err )
1048+ }
1049+ }(modsToAdd , modsToDelete )
10371050 if err := i .node .SetModeratorsOnListings (* settings .StoreModerators ); err != nil {
10381051 ErrorResponse (w , http .StatusInternalServerError , err .Error ())
10391052 }
@@ -1847,7 +1860,12 @@ func (i *jsonAPIHandler) GETModerators(w http.ResponseWriter, r *http.Request) {
18471860 id := r .URL .Query ().Get ("asyncID" )
18481861 if id == "" {
18491862 idBytes := make ([]byte , 16 )
1850- rand .Read (idBytes )
1863+ _ , err := rand .Read (idBytes )
1864+ if err != nil {
1865+ // TODO: if this happens, len(idBytes) != 16
1866+ // how to handle this
1867+ log .Error (err )
1868+ }
18511869 id = base58 .Encode (idBytes )
18521870 }
18531871
@@ -2175,7 +2193,10 @@ func (i *jsonAPIHandler) GETCase(w http.ResponseWriter, r *http.Request) {
21752193 return
21762194 }
21772195
2178- i .node .Datastore .Cases ().MarkAsRead (orderID )
2196+ err = i .node .Datastore .Cases ().MarkAsRead (orderID )
2197+ if err != nil {
2198+ log .Error (err )
2199+ }
21792200 SanitizedResponseM (w , out , new (pb.CaseRespApi ))
21802201}
21812202
@@ -2566,11 +2587,20 @@ func (i *jsonAPIHandler) POSTMarkChatAsRead(w http.ResponseWriter, r *http.Reque
25662587 }
25672588 }
25682589 if subject != "" {
2569- go func () {
2570- i .node .Datastore .Purchases ().MarkAsRead (subject )
2571- i .node .Datastore .Sales ().MarkAsRead (subject )
2572- i .node .Datastore .Cases ().MarkAsRead (subject )
2573- }()
2590+ go func (subject string ) {
2591+ err := i .node .Datastore .Purchases ().MarkAsRead (subject )
2592+ if err != nil {
2593+ log .Error (err )
2594+ }
2595+ err = i .node .Datastore .Sales ().MarkAsRead (subject )
2596+ if err != nil {
2597+ log .Error (err )
2598+ }
2599+ err = i .node .Datastore .Cases ().MarkAsRead (subject )
2600+ if err != nil {
2601+ log .Error (err )
2602+ }
2603+ }(subject )
25742604 }
25752605 SanitizedResponse (w , `{}` )
25762606}
@@ -2809,7 +2839,12 @@ func (i *jsonAPIHandler) POSTFetchProfiles(w http.ResponseWriter, r *http.Reques
28092839 id := r .URL .Query ().Get ("asyncID" )
28102840 if id == "" {
28112841 idBytes := make ([]byte , 16 )
2812- rand .Read (idBytes )
2842+ _ , err := rand .Read (idBytes )
2843+ if err != nil {
2844+ // TODO: if this happens, len(idBytes) != 16
2845+ // how to handle this
2846+ log .Error (err )
2847+ }
28132848 id = base58 .Encode (idBytes )
28142849 }
28152850
@@ -3184,7 +3219,12 @@ func (i *jsonAPIHandler) POSTBlockNode(w http.ResponseWriter, r *http.Request) {
31843219 nodes = append (nodes , pid )
31853220 }
31863221 }
3187- go ipfs .RemoveAll (i .node .IpfsNode , peerID , i .node .IPNSQuorumSize )
3222+ go func (nd * ipfscore.IpfsNode , peerID string , quorum uint ) {
3223+ err := ipfs .RemoveAll (nd , peerID , quorum )
3224+ if err != nil {
3225+ log .Error (err )
3226+ }
3227+ }(i .node .IpfsNode , peerID , i .node .IPNSQuorumSize )
31883228 nodes = append (nodes , peerID )
31893229 settings .BlockedNodes = & nodes
31903230 if err := i .node .Datastore .Settings ().Put (settings ); err != nil {
@@ -3625,7 +3665,12 @@ func (i *jsonAPIHandler) POSTFetchRatings(w http.ResponseWriter, r *http.Request
36253665 id := r .URL .Query ().Get ("asyncID" )
36263666 if id == "" {
36273667 idBytes := make ([]byte , 16 )
3628- rand .Read (idBytes )
3668+ _ , err := rand .Read (idBytes )
3669+ if err != nil {
3670+ // TODO: if this happens, len(idBytes) != 16
3671+ // how to handle this
3672+ log .Error (err )
3673+ }
36293674 id = base58 .Encode (idBytes )
36303675 }
36313676
@@ -3853,7 +3898,12 @@ func (i *jsonAPIHandler) GETIPNS(w http.ResponseWriter, r *http.Request) {
38533898 ErrorResponse (w , http .StatusInternalServerError , err .Error ())
38543899 return
38553900 }
3856- go ipfs .Resolve (i .node .IpfsNode , pid , time .Minute , i .node .IPNSQuorumSize , false )
3901+ go func (nd * ipfscore.IpfsNode , pid peer.ID , timeout time.Duration , quorum uint , useCache bool ) {
3902+ _ , err := ipfs .Resolve (nd , pid , timeout , quorum , useCache )
3903+ if err != nil {
3904+ log .Error (err )
3905+ }
3906+ }(i .node .IpfsNode , pid , time .Minute , i .node .IPNSQuorumSize , false )
38573907 fmt .Fprint (w , string (retBytes ))
38583908}
38593909
0 commit comments