summaryrefslogtreecommitdiffstats
path: root/api/post.go
diff options
context:
space:
mode:
authorJosta Yee <jostyee@users.noreply.github.com>2017-03-20 21:20:42 +0800
committerenahum <nahumhbl@gmail.com>2017-03-20 10:20:42 -0300
commite86add77ad311a7b7112e67731770695d5d4a72d (patch)
tree6591c3d8f136171dffcaf80a35bc82ef593a0b87 /api/post.go
parent76f8420a52f44f62fa7fe1a777ad1de66e72c034 (diff)
downloadchat-e86add77ad311a7b7112e67731770695d5d4a72d.tar.gz
chat-e86add77ad311a7b7112e67731770695d5d4a72d.tar.bz2
chat-e86add77ad311a7b7112e67731770695d5d4a72d.zip
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
Diffstat (limited to 'api/post.go')
-rw-r--r--api/post.go2
1 files changed, 1 insertions, 1 deletions
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)
}