Skip to content

Commit

Permalink
Fix singleflight blog
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Sjoberg committed Sep 21, 2023
1 parent 2ed4e86 commit 897d89b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions content/english/blog/golang/singleflight.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
---
title: "Singleflight"
meta_title: ""
description: "Singleflight in Golang"
date: 2022-04-04T05:00:00Z
image: "/images/singleflight.png"
categories: ["golang", "concurrency"]
author: "Hugo Sjoberg"
tags: ["golang", "concurrency"]
draft: false
---

# Why Singleflight?

Imagine you are running a service that calls a slow operation, let's say it makes an expensive query to a database. Now this particular service is a popular one, before the first query even returned a result 10 more identical requests were made.

Wouldn't it be nice if we didn't have to call the database 10 times but instead return the data we get back from the first request to all other requests?
Expand Down

0 comments on commit 897d89b

Please sign in to comment.