210 похожих чатов

Hi everyone. Is there a way to implement some kind

of "cron" in subgraph? I need to create some entity in the start of each day

I tried to add a block handler and check hour === 0:

export function handleBlock(block: ethereum.Block): void {
const currentDayId = block.timestamp.toI32() / 86400
const hour = (block.timestamp.toI32() - currentDayId * 86400) / 3600

if (hour !== 0) {
return
}

...
}

but it makes my subgraph to slow to sync after redeploy. Even during blocks which was generated at 1-23 hours.
Maybe there is some utility contract wich emit events DayStarted?)

5 ответов

12 просмотров

Hi Sergey! Thanks for your question. I'll suggest you post it through our Discord channel to get technical support. thegraph.com/discord 👀

There is not a cron function yet, but this was recently discussed on the forums. Block handlers are unfortunately slow since it stops at every block to check logic. These questions are probably best answered in the subgraph developer channel in discord. I have a couple ideas that might be worth trying out.

Sergei-Krivochenko Автор вопроса
DataNexus
There is not a cron function yet, but this was rec...

Could you give me a link to the message there it was discussed? Search on channel does not give me result. Thanks

Sergei Krivochenko
Could you give me a link to the message there it w...

https://forum.thegraph.com/t/grp-0001-decorator-hooks-cron-jobs-and-initialisation-handlers/3347

Похожие вопросы

Обсуждают сегодня

Ready for some fun AND a chance to win TKO Tokens? Join us for exciting minigames in our Telegram group! 🕒 Don’t miss out—games start on today 25 October 2024, at 8 PM! Ge...
Milkyway | Tokocrypto
255
VIP-392 [zkSync] New native USDC market in the Core pool Summary If passed, following the Community proposal “Support native USDC on Venus Core Pool of ZKSync Era” and the a...
Venus Announcements
1
is that okay?
Samurai 🇯🇵
21
How about the project bro Likes the community not that active ?
🅿️abby_FX
19
Guys, Donald Trump or Kamala Harris? It does not matter for Bitcoin in the long run!! 2020 Election: After Joe Biden's victory in November 2020, Bitcoin steadily rose from...
Sabah Shabu
3
checking for Berkeley DB C++ headers... no configure: error: libdb_cxx headers missing, Litecoin Core requires this library for wallet functionality (--disable-wallet to disab...
GNU/Линуксяша-libre (";("
5
@brucezli Any info regarding ETA on updates?
Old Man Tom
10
------------------------------------------------------------------------------ 📢 MAJOR ANNOUNCEMENT: HSUITE ECOSYSTEM UPDATE 📢 @everyone Dear HbarSuite Community, After month...
Big Stones
3
Is like having a company with great talents, early investors & workers who joined a company but saw that the vision was getting lost so they pushed for a change from within. T...
Randall Roland
2
error: Provider exception on decrypt DDO. Status: Request failed with status code 400 error: INDEXER: Error processMetadataEvents: Error: Provider exception on decrypt...
Bordo Tor
6
Карта сайта