Skip to content

Commit

Permalink
update telegroam.js from mbrock#30 with correct binary-semaphore API
Browse files Browse the repository at this point in the history
  • Loading branch information
cori committed Dec 29, 2022
1 parent 25657fd commit 29b2758
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions telegroam.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,10 @@

let url = urlWithParams(
"https://www.openstreetmap.org/export/embed.html", {
layer: "mapnik",
bbox,
marker
})
layer: "mapnik",
bbox,
marker
})

return {
embed: `:hiccup[:iframe {
Expand Down Expand Up @@ -548,14 +548,14 @@
roamAlphaAPI.util.generateUID()

let lockPath =
`https://binary-semaphore.herokuapp.com/lock/${lockId}/${nonce}`
`https://binary-semaphore.glitch.me/lock/${lockId}/${nonce}`

let acquirePath = `${lockPath}/acquire`
let releasePath = `${lockPath}/release`
let acquirePath = `${lockPath}`
let releasePath = `${lockPath}`

for (;;) {
for (; ;) {
let result =
await fetch(acquirePath, { method: "POST" })
await fetch(acquirePath, { method: "PUT" })

if (result.status === lockStatus.ok) {
currentLockPath = lockPath
Expand All @@ -566,7 +566,7 @@
console.log("telegroam: releasing lock")
currentLockPath = null
try {
await fetch(releasePath, { method: "POST" })
await fetch(releasePath, { method: "DELETE" })
} catch (e) {
console.error(e)
throw e
Expand All @@ -581,7 +581,7 @@
}

async function updateFromTelegramContinuously() {
for (;;) {
for (; ;) {
try {
let result = await runWithMutualExclusionLock({
waitSeconds: 30,
Expand Down

0 comments on commit 29b2758

Please sign in to comment.