Masterthesis
This commit is contained in:
parent
6de476260d
commit
a21bbcca0e
9 changed files with 140 additions and 211 deletions
|
@ -88,26 +88,26 @@ func PostInboxHandler(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
if foundObject == nil {
|
||||
_ = object.CreateObject(newActivity.Object)
|
||||
/*
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
if err := json.NewEncoder(w).Encode(fmt.Sprintf("Database Error Creating Object: %s", err)); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return
|
||||
}
|
||||
*/
|
||||
}
|
||||
_ = CreateCollectionObject(utils.GenerateInboxUrl(actorName), newActivity.Object.Id)
|
||||
/*
|
||||
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
if err := json.NewEncoder(w).Encode(fmt.Sprintf("Database Error Creating Collection Object: %s", err)); err != nil {
|
||||
if err := json.NewEncoder(w).Encode(fmt.Sprintf("Database Error Creating Object: %s", err)); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
_ = CreateCollectionObject(utils.GenerateInboxUrl(actorName), newActivity.Object.Id)
|
||||
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
if err := json.NewEncoder(w).Encode(fmt.Sprintf("Database Error Creating Collection Object: %s", err)); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
log.Printf("%s to %s: %s", newActivity.Actor, newActivity.To, newActivity.Object.Content)
|
||||
} else {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
|
@ -231,8 +231,6 @@ func PostOutboxHandler(w http.ResponseWriter, r *http.Request) {
|
|||
log.Printf("Error Sending Activity, retrying in %ss: %s", duration/1000000000, err)
|
||||
}
|
||||
backoff.RetryNotify(operation, backoff.WithMaxRetries(backoff.NewExponentialBackOff(), 16), notify)
|
||||
|
||||
//go retryActivity(newActivity, recipient, token)
|
||||
}
|
||||
|
||||
response := OutboxResponse{
|
||||
|
@ -246,22 +244,6 @@ func PostOutboxHandler(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
func retryActivity(activityToSend *activity.Activity, recipient string, token string) (err error) {
|
||||
b, cancel := config.BackoffPolicy.Start(context.Background())
|
||||
defer cancel()
|
||||
|
||||
for backoff.Continue(b) {
|
||||
err := SendActivity(activityToSend, recipient, token)
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
err = errors.New("Not able to send activity")
|
||||
return
|
||||
}
|
||||
*/
|
||||
|
||||
func GetReciepientsForActivity(activityToSend *activity.Activity) (err error, recipientsWithoutDuplicates []string) {
|
||||
recipients := []string{}
|
||||
if strings.Contains(activityToSend.To, config.Homeserver) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue