From e86add77ad311a7b7112e67731770695d5d4a72d Mon Sep 17 00:00:00 2001 From: Josta Yee Date: Mon, 20 Mar 2017 21:20:42 +0800 Subject: Add http_proxy support for http client (#5571) - if 'http_proxy' environment variable is set, respect it when creating http client - otherwise initialize a http client with timeout settings Add ogjson to cache even when it fails in this way we can prevent from requesting unparsable urls repeatedly Extend expire time of cached link preview data to a week There's no need to invalidate cache and send request again frequently Revert timeout Revert cache_expire_time --- api/post.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'api/post.go') diff --git a/api/post.go b/api/post.go index 4944ad28f..afe60144d 100644 --- a/api/post.go +++ b/api/post.go @@ -530,11 +530,11 @@ func getOpenGraphMetadata(c *Context, w http.ResponseWriter, r *http.Request) { og := app.GetOpenGraphMetadata(url) ogJSON, err := og.ToJSON() + openGraphDataCache.AddWithExpiresInSecs(props["url"], ogJSON, 3600) // Cache would expire after 1 hour if err != nil { w.Write([]byte(`{"url": ""}`)) return } - openGraphDataCache.AddWithExpiresInSecs(props["url"], ogJSON, 3600) // Cache would expire after 1 houre w.Write(ogJSON) } -- cgit v1.2.3-1-g7c22