~mariusor/fedbox-spammy

d9150b4070ed914324ba2c3bcfb1506e6a59ee3b — Marius Orcsik 4 months ago 7fc610f master
Made the timeouts for requests uniform at 5 seconds
2 files changed, 3 insertions(+), 3 deletions(-)

M loader.go
M spammer.go
M loader.go => loader.go +1 -1
@@ 18,7 18,7 @@ type loader struct {

func (l loader) loadFn(ctx context.Context, i ap.IRI) func() error {
	return func() error {
		dtx, _ := context.WithTimeout(ctx, 2*time.Second)
		dtx, _ := context.WithTimeout(ctx, 5*time.Second)
		//defer cancelFn()

		ob, err := l.f.CtxLoadIRI(dtx, i)

M spammer.go => spammer.go +2 -2
@@ 345,7 345,7 @@ func C2SSign(ctx context.Context, act *ap.Actor, pw string) client.RequestSignFn
		// set a custom http client to be used by the OAuth2 package, in our case, it has InsecureTLSCheck disabled
		//ctx = context.WithValue(ctx, oauth2.HTTPClient, httpClient)

		dtx, cancelFn := context.WithTimeout(ctx, 200*time.Millisecond)
		dtx, cancelFn := context.WithTimeout(ctx, 5*time.Second)
		defer func() {
			cancelFn()
			m.Unlock()


@@ 380,7 380,7 @@ func setSignFn(ctxt context.Context, f *client.C, activity ap.Item, pw string) e
	})
}

func ExecActivity(ctx context.Context, f *client.C, activity ap.Item) (ap.Item, error) {
func ExecActivity(ctx context.Context, f *client.C, activity ap.Item, pw string) (ap.Item, error) {
	dtx, cancelFn := context.WithTimeout(ctx, 5*time.Second)
	defer cancelFn()