1
0
mirror of synced 2025-02-21 20:29:50 +01:00

23 Commits

Author SHA1 Message Date
beerpsi
58a5177a30 use SQL's limit/offset pagination for nextIndex/maxCount requests (#185)
Instead of retrieving the entire list of items/characters/scores/etc. at once (and even store them in memory), use SQL's `LIMIT ... OFFSET ...` pagination so we only take what we need.

Currently only CHUNITHM uses this, but this will also affect maimai DX and O.N.G.E.K.I. once the PR is ready.

Also snuck in a fix for CHUNITHM/maimai DX's `GetUserRivalMusicApi` to respect the `userRivalMusicLevelList` sent by the client.

### How this works

Say we have a `GetUserCharacterApi` request:

```json
{
    "userId": 10000,
    "maxCount": 700,
    "nextIndex": 0
}
```

Instead of getting the entire character list from the database (which can be very large if the user force unlocked everything), add limit/offset to the query:

```python
select(character)
.where(character.c.user == user_id)
.order_by(character.c.id.asc())
.limit(max_count + 1)
.offset(next_index)
```

The query takes `maxCount + 1` items from the database to determine if there is more items than can be returned:

```python
rows = ...

if len(rows) > max_count:
    # return only max_count rows
    next_index += max_count
else:
    # return everything left
    next_index = -1
```

This has the benefit of not needing to load everything into memory (and also having to store server state, as seen in the [`SCORE_BUFFER` list](2274b42358/titles/chuni/base.py (L13)).)

Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/185
Co-authored-by: beerpsi <beerpsi@duck.com>
Co-committed-by: beerpsi <beerpsi@duck.com>
2024-11-16 19:10:29 +00:00
EmmyHeart
8f4c08f825 Fix map overload in Chusan 2024-09-14 01:28:35 +00:00
beerpsi
5378655c52 [chunithm] Support LUMINOUS 2024-06-20 08:11:24 +07:00
Kevin Trocolli
3559d56ccf cm: add awaits (fixes #104) 2024-03-02 17:55:41 -05:00
Hay1tsme
05586df08a move to async database 2024-01-09 14:42:17 -05:00
Kevin Trocolli
14fa0f5e8e begin move 2024-01-09 03:07:04 -05:00
Kevin Trocolli
01591a0456 chuni: revert changes to udpHolePunchUri and reflectorUri 2024-01-08 21:23:10 -05:00
Kevin Trocolli
b4b40869c1 chuni: add roomId to handle_get_matching_state_api_request, update changelog 2024-01-08 20:21:27 -05:00
Hay1tsme
1b3e43b918 chuni: Imrpove GetGameSetting request handling for different versions 2024-01-08 18:30:03 -05:00
Hay1tsme
27bf51f9f8 chuni: add matching config, stun turn stuff 2024-01-08 18:22:09 -05:00
EmmyHeart
97963adf38 Updated matchnaming URLs to use game codes 2023-12-13 06:07:40 +00:00
Kevin Trocolli
cb8eaae2c0 Per-version URI/Host (#66)
Allows setting allnet uri/host response based on things like version, config files, and other factors to accommodate a wider range of potential setups under the same roof. This DOES require all titles to adopt a new structure but it's documented and should hopefully be somewhat intuitive.

Co-authored-by: Hay1tsme <kevin@hay1ts.me>
Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/66
Co-authored-by: Kevin Trocolli <pitok236@gmail.com>
Co-committed-by: Kevin Trocolli <pitok236@gmail.com>
2023-11-09 02:17:48 +00:00
EmmyHeart
540d7fc2c2 Added reboot time support 2023-10-16 13:18:23 +00:00
Dniel97
b85a65204f
chuni: added SUN support, matchmaking, fixed bugs, added docs
- Added CHUNITHM SUN support
- Added first matchmaking support with CPU spawning and messages
- Fixed wrong `next_idx` calculations
- Added `startDate` to events to spawn the correct items
- Fixed login bonus per version
- Added information to docs
2023-05-10 21:32:35 +02:00
Dniel97
1aa92458f4
chuni: added login bonus (+importer), fixed config strings 2023-03-28 18:28:57 +02:00
Dniel97
541fe76a7c
cardmaker: fixed chuni endless loading 2023-03-28 01:09:16 +02:00
Dniel97
2a290f2a3d
chuni: added teams and ticket saving, fixed last played song 2023-03-24 18:10:10 +01:00
Dniel97
2af7751504 Added support for maimai and Chunithm in Card Maker 1.34/1.35 (#14)
Co-authored-by: Dniel97 <Dniel97@noreply.gitea.tendokyu.moe>
Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/14
Co-authored-by: Dniel97 <dniel97@noreply.gitea.tendokyu.moe>
Co-committed-by: Dniel97 <dniel97@noreply.gitea.tendokyu.moe>
2023-03-15 20:03:22 +00:00
Raymonf
b076a9a9df
chuni: Add 'handle_remove_token_api_request' for event mode
Not sure if `handle_delete_token_api_request` is used in other versions, so it's duplicated to be safe.
2023-03-09 15:16:59 -05:00
Hay1tsme
a76bb94eb1 let black do it's magic 2023-03-09 11:38:58 -05:00
Dniel97
842e3a313e
chuni: use title hostname instead of server hostname 2023-03-01 21:18:29 +01:00
Dniel97
b81767af8a
Chunithm New!!+ Importer and settings fixed 2023-03-01 21:09:06 +01:00
Hay1tsme
7e3396a7ff add back games, conform them to new title dispatch 2023-02-17 01:02:21 -05:00