Git Product home page Git Product logo

Comments (3)

cybermelons avatar cybermelons commented on August 15, 2024 2

I've drafted a sample implementation of a cache policy seen here: https://github.com/tsaibermelon/gg-struggle/blob/3fd846e0fedf556e2355fb0621841025dd49e9e3/server/local.json

It uses regexes to categorize the routes and the times are human-readable time strings.

from gg-struggle.

fsantand avatar fsantand commented on August 15, 2024

I was about to post about this too, maybe a cache policy according depending on the endpoints, it could be mapped on a constant layer on a json file, or something of that style.

const EXPIRE_TIME_TOWER_PROGRESSION = 1000 * 60 * 60 * 30 // Maybe 30 minutes is a right time
const EXPIRE_TIME_STATISTICS = 1000 * 60 * 60 * 60 * 24

const ENDPOINT_TO_CACHE_POLICY_MAPPING = {
    "statistics": EXPIRE_TIME_STATISTICS,
    "rank": EXPIRE_TIME_TOWER_PROGRESSION,
    ...
}

I do not know the exact endpoints of the GGST API, but maybe something like that would reduce the tower progression errors. Or maybe not even include caching for rank/tower progression, since it changes a lot.

Also, depending of the HTTP Method, it could discriminate the POST requests for the rank progressions, that should help something

from gg-struggle.

cybermelons avatar cybermelons commented on August 15, 2024

Does struggle get any of the data unencrypted by any chance?

Yup. The unencrypted responses and requests are dumped to their own file, named <key>.<gameReq|ggResp>.dump, where the key is a hash of the url, method, and raw request payload. Their metadata is stored in a sqlite db named gg-struggle.db. All this is found in %TEMP%

There are requests and responses tables in the db, and by joining them by the dumpKey column, we get the whole transaction.

Sample query

      SELECT
        req.dumpkey as dumpKey,
        req.url as url,
        req.method as method,
        req.headers as reqHeaders,
        req.timeStart as reqTimeStart,
        req.timeEnd as reqTimeEnd,

        resp.statusCode as respStatusCode,
        resp.headers as respHeaders,
        resp.payloadSize as respPayloadSize,
        resp.timeStart as respTimeStart,
        resp.timeEnd as respTimeEnd
      FROM requests AS req
      LEFT JOIN responses AS resp USING (dumpKey)

So with this you can get the metadata from the db, and read the raw payloads in the dumps directory.

from gg-struggle.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.