-
-
Save emretanriverdi/43683f54a65f52d0f5f3602d76ac37ac to your computer and use it in GitHub Desktop.
goroutine-initial.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func upsert(user User) { | |
go upsertToPostgres(user) | |
upsertToCouchbase(user, "key") | |
} | |
func upsertToPostgres(user User) { | |
fmt.Println("# upserting userId to two tables in Postgres") | |
time.Sleep(20 * time.Millisecond) | |
fmt.Println("# upserting userName to one table in Postgres") | |
time.Sleep(10 * time.Millisecond) | |
} | |
func upsertToCouchbase(user User, key string) { | |
fmt.Println("# upserting to Couchbase") | |
time.Sleep(5 * time.Millisecond) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment