Skip to content

Conversation

@blizzz
Copy link
Member

@blizzz blizzz commented Jun 19, 2025

Quick PoC: NotModifiedMiddleware respects last modified information stored with a data response. The business logic still runs, but at least clients will not need to do any heavy lifting, as only 304 is returned if the condition pertains.

Dropping it here quickly in case someone wants to pick this up.

@blizzz blizzz added enhancement New feature or request 2. developing Work in progress labels Jun 19, 2025
$rows = $this->rowService->findAllByTable($tableId, $this->userId, $limit, $offset);
$response = new DataResponse($this->rowService->formatRows($rows));
$table = $this->tableService->find($tableId);
$lastModified = new \DateTime($table->getLastEditAt());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure that any change of rows would update the getLastEditAt date? Otherwise this would not have much benefit i think.

Copy link
Member Author

@blizzz blizzz Jun 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not double check it yet, it is merely my expectation. I was wondering whether this is also updated, when a row is being deleted.

return new DataResponse($this->rowService->formatRows($this->rowService->findAllByTable($tableId, $this->userId, $limit, $offset)));
$rows = $this->rowService->findAllByTable($tableId, $this->userId, $limit, $offset);
$response = new DataResponse($this->rowService->formatRows($rows));
$table = $this->tableService->find($tableId);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could move this line first and return a 304 early in case the if-modified-since matches, before doing the possibly heavier operations of fetching the rows

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, definitely. First I thought i had to analyze the rows that were fetched, then i was reminded about the last modificated set in the table (if that really works as i think). I pushed this to not have it rotting away locally and turning to legend in first place 🙂

@enjeck enjeck force-pushed the poc/noid/last-modified branch from 0af84d9 to 458b886 Compare October 30, 2025 09:01
@enjeck enjeck self-assigned this Oct 30, 2025
Copy link
Contributor

@enjeck enjeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm gonna take over this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants