[ENG/ITA] SplinterRoi: If It Works, It Works

La versione italiana si trova sotto quella inglese

The italian version is under the english one

SplinterRoi: If It Works, It Works

Today I wanted to take a look at the rental ROI of some cards using SplinterROIthe little site I specifically created for this purpose – but, for some reason I couldn’t figure out at first, no matter what search I tried, I couldn’t get any result, with the site apparently loading endlessly but generating no data at all.



After trying to tweak some filters here and there and waiting a bit, I decided to check the Splinterlands site and…



Mystery possibly solved!

I’m not 100% sure, but it could be that when the game is put in “maintenance mode” the APIs also stop working or at least become much less responsive, making it hard to get data from the game.

This is obviously a problem for SplinterROI as well, since its operation relies entirely on real-time responses from Splinterlands APIs: if they don’t respond, or take a long time to do so, the site can’t generate any result, leaving the user wondering what’s going on and whether the site is even working.

Important – and well-made – sites like Peakmonsters solve this problem by showing a dedicated screen that informs the user of the ongoing maintenance, asking them to try connecting again later.



It’s a simple and elegant solution that saves the user from wasting time and unnecessary frustration.

So I thought it was worth trying to implement something similar on SplinterROI as well, since at the moment the site doesn’t handle this scenario at all, nor – to be honest – other similar but different situations, like a possible heavy slowdown in API responses from Splinterlands.

That’s why I went digging into the game’s APIs to see if I could find something useful and at first, I thought I had found it:

curl -X 'GET' \
  'https://api.splinterlands.com/maintenance_schedule' \
  -H 'accept: application/json'

Too bad the response from this API is quite unclear to me and maybe useless for my specific purpose...


Think, think, think...

The great thing about programming, however, is that often for the same problem there are multiple solutions: some not equally effective, but for a small amateur project, certain details can easily be ignored.

So I decided to add a very simple check in my script that should help my site handle two different situations at once:

  • total lack of response from the APIs
  • excessively slow responses from the APIs

Basically, I’ll just add a condition that, if a request takes too long – say 30 seconds – triggers a notification telling the user that:

  • either their query involves too much data and needs to be simplified
  • or there’s an API issue and they need to try again later

The downside, though, is that this upgrade technically might not solve the original problem, which was notifying the user about possible game maintenance – it might have just been a coincidence that the APIs were slow or unresponsive right during a maintenance period...

However, the truth is I only care about the APIs working, so even if indirectly, the solution I found... works and still allows me to bring a small but useful improvement to my site!

As always, here’s the updated repo of the project:

And here are the previous posts I published about SplinterROI:


images owned by @splinterlands and/or their respective owners; cover edited with GIMP

to support the #OliodiBalena community, @balaenoptera is 3% beneficiary of this post

If you've read this far, thank you! If you want to leave an upvote, a reblog, a follow, a comment... well, any sign of life is really much appreciated!

If you are not registered on Splinterlands ... well, you are still in time to do the right thing.

And if you want to find out how much each card in Splinterlands yields on the rental market, you can now do so via SplinterROI.

drawing made by @ahmadmanga

Versione italiana

Italian version

SplinterRoi: Se Funziona, Funziona

Oggi volevo dare un'occhiata al ROI da noleggio di alcune carte sfruttando SplinterROI - il piccolo sito che ho creato appositamente a questo scopo - ma, per qualche motivo che all'inizio non capivo, qualsiasi ricerca provassi a fare non riuscivo ad ottenere alcun risultato, con il sito che apparentemente caricava all'infinito senza però generare alcun dato.



Dopo aver provato a cambiare qualche filtro qui e là e ad attendere un po', ho deciso di dare un'occhiata al sito di Splinterlands e...



Possibile causa del mistero svelata!

Non ne sono sicuro al 100%, ma può darsi che quando il gioco viene messo in modalità "manutenzione" anche le API smettano di funzionare o siano comunque molto meno reattive, rendendo difficile ottenere dati dal gioco.

Questo è ovviamente un problema anche per SplinterROI, dato che il suo funzionamento poggia interamente sulle risposte ottenute in tempo reale dalle API di Splinterlands: se questo non rispondono, o ci mettono un sacco di tempo, il sito non può generare alcun risultato, portando l'eventuale utente a chiedersi cosa stia succedendo e se il sito funzioni o meno.

Siti importanti - e ben fatti - come Peakmonsters risolvono questo problema mostrando una schermata apposita, che avvisa l'utente della manutenzione in corso, invitandolo a riprovare a connettersi più tardi.



Si tratta di una soluzione semplice ed elegante, che evita all'utente inutili perdite di tempo e conseguente frustrazione.

Penso quindi che valga la pena tentare di implementare qualcosa del genere anche su SplinterROI, dato che attualmente il sito non gestisce in alcun modo questa situazione nè, a dirla tutta, situazioni simili ma differenti, come un eventuale forte rallentamento nelle risposte ricevute dalle API di Splinterlands.

Per questo sono andato a cercare nelle API del gioco per vedere se trovavo qualcosa che potesse fare al caso mio e lì per lì pensavo anche di averlo trovato:

curl -X 'GET' \
  'https://api.splinterlands.com/maintenance_schedule' \
  -H 'accept: application/json'

Peccato che la risposta ottenuta da questa API sia per me molto poco chiara e forse inutile per quello che è il mio scopo...


Pensa, pensa, pensa...

Il bello della programmazione, però, è che spesso per uno stesso problema ci sono più soluzioni: alcune non tutte egualmente efficaci, ma se si tratta di un progetto amatoriale di basso livello certi dettagli possono anche essere tranquillamente ignorati.

Per questo ho deciso di inserire nel mio script un controllo molto semplice che dovrebbe aiutare il mio sito a gestire in un colpo solo due differenti situazioni:

  • la totale mancata risposta da parte delle API
  • l'invio di risposte eccessivamente lente dalle API

In pratica, mi limiterò ad inserire una condizione che, al passaggio di un tempo eccessivamente lungo, ad esempio 30 secondi, attiva una notifica che segnala all'utente che:

  • o la sua ricerca coinvolge troppi dati e deve quindi essere semplificata
  • o c'è un problema con le API e deve quindi riprovare più tardi

L'effetto negativo, però, è che questo upgrade tecnicamente potrebbe non risolvere quello che era l'originale problema da affrontare, ossia avvisare l'utente di una eventuale manutenzione in corso sul gioco - potrebbe essere stato infatti un caso il fatto che le API fossero lente o poco responsive proprio durante un periodo di manutenzione...

Tuttavia la verità è che a me interessa solo che le API funzionino, per cui, anche se per una via traversa, la soluzione che ho trovato alla fine... funziona e mi consente comunque di apportare un piccolo, ma utile, miglioramento al mio sito!

Come sempre, qui trovate la repo aggiornata del progetto:

Mentre questi sono i precedenti post che ho pubblicato su SplinterROI:


immagini di proprietà di @splinterlands e dei rispettivi proprietari; cover da me editata con GIMP

a supporto della community #OliodiBalena, il 3% delle ricompense di questo post va a @balaenoptera

Se sei arrivato a leggere fin qui, grazie! Se hai voglia di lasciare un upvote, un reblog, un follow, un commento... be', un qualsiasi segnale di vita, in realtà, è molto apprezzato!

Se non sei registrato su Splinterlands... be', sei in tempo per rimediare.

E se vuoi scoprire quanto rende sul mercato dei noleggi ciascuna carta presente su Splinterlands, adesso puoi farlo tramite il sito SplinterROI.



disegno realizzato da @ahmadmanga

Posted Using INLEO

0.31779380 BEE
7 comments

Figa ma anche tu sei uno di quelli di matrix allora... solo io non so fare niente...
Hai creato un sito per guardare le roi di spt?
Graaande

0.00000584 BEE

Seeee magari! Ho imparato due cavolate da autodidatta e mi diletto a fare scemenze di bassissimo livello...

Te sai suonare, altro che non saper fare niente!

Hai creato un sito per guardare le roi di spt?

Sì, il ROI da noleggio delle carte: imposti i filtri, il sito recupera tutte le carte noleggiate in quel momento sul mercato che rientrano nella tua selezione, guarda quanto costano e ti dice così quanto rendono a noleggio.

Per me che ormai faccio solo quello è davvero comodo, perchè mi aiuta ad individuare le carte che rendono di più e ad impostare meglio i prezzi di quelle che già ho e noleggio.

!LOL

0.00000000 BEE

This post has been supported by @Splinterboost with a 12% upvote! Delagate HP to Splinterboost to Earn Daily HIVE rewards for supporting the @Splinterlands community!

Delegate HP | Join Discord

0.00000000 BEE


This post has been supported by @fallen.angels guild!
Delegate Tokens and HP to Fallen Angels to earn weekly rewards!
Delegate | Join to the guild

0.00000000 BEE

Congratulations @arc7icwolf! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

You received more than 190000 upvotes.
Your next target is to reach 200000 upvotes.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out our last posts:

0.00000000 BEE

Questo tuo tool è utilissimo e continui a migliorarlo! Se una soluzione funziona è sempre una buona soluzione ;)
!PIMP
!discovery 30

0.00000000 BEE

This post was shared and voted inside the discord by the curators team of discovery-it
Join our Community and follow our Curation Trail
Discovery-it is also a Witness, vote for us here
Delegate to us for passive income. Check our 80% fee-back Program
0.00000000 BEE

Thanks for sharing! - @mango-juice

0.00000000 BEE