diff options
-rw-r--r-- | archive.go | 13 | ||||
-rw-r--r-- | archive_test.go | 1 | ||||
-rw-r--r-- | keep.go | 4 |
3 files changed, 9 insertions, 9 deletions
@@ -22,8 +22,9 @@ var ( ) type Save struct { - URL string `json:"url"` - Job string `json:"job_id"` + URL string `json:"url"` + Job string `json:"job_id"` + Message string `json:"message"` } type Wayback struct { @@ -68,7 +69,7 @@ func isArchived(url string) (bool, int) { return av.Snapshots.Recent.Available, status } -func archive(accessKey string, secretKey string, URL string) (int, string) { +func archive(accessKey string, secretKey string, URL string) (int, string, string) { params := url.Values{} params.Set("url", URL) @@ -85,14 +86,14 @@ func archive(accessKey string, secretKey string, URL string) (int, string) { if e, _ := err.(net.Error); !e.Timeout() { log.Println("SAVE", err) } - return 0, "" + return 0, "", "" } defer resp.Body.Close() save := &Save{} decoder := json.NewDecoder(resp.Body) if err := decoder.Decode(save); err != nil { log.Println("SAVE", err) - return 0, "" + return 0, "", "" } - return resp.StatusCode, save.Job + return resp.StatusCode, save.Job, save.Message } diff --git a/archive_test.go b/archive_test.go index 842b3b3..d9fc149 100644 --- a/archive_test.go +++ b/archive_test.go @@ -1,7 +1,6 @@ package main import ( - "net/http" "testing" ) @@ -144,9 +144,9 @@ func archiver(accessKey string, secretKey string, db *SqliteDB) { } // Archive, URL is not present in cache or IA - statusCode, jobID := archive(accessKey, secretKey, message.URL) + statusCode, jobID, msg := archive(accessKey, secretKey, message.URL) + log.Println("SAVE", statusCode, message.URL, jobID, msg) db.AddArchived(message, statusCode) - log.Println("SAVE", statusCode, message.URL, jobID) // Limit requests to Wayback API to 15-second intervals time.Sleep(15 * time.Second) |