This file contains hidden or 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
package examples | |
import ( | |
"github.com/XANi/loremipsum" | |
"github.com/go-chi/chi/v5" | |
. "github.com/starfederation/datastar-dev/site/shared" | |
datastar "github.com/starfederation/datastar/sdk/go" | |
"math/rand/v2" | |
"net/http" | |
"time" |
This file contains hidden or 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
defmodule Task do | |
defp await_one(tasks, timeout \\ 5_000) when is_list(tasks) do | |
awaiting = | |
Map.new(tasks, fn %Task{ref: ref, owner: owner} = task -> | |
if owner != self() do | |
raise ArgumentError, invalid_owner_error(task) | |
end | |
{ref, true} | |
end) |
OlderNewer