hatena-server icon indicating copy to clipboard operation
hatena-server copied to clipboard

the server is not able to find generated files until server restart

Open mtboss124 opened this issue 1 year ago • 10 comments

any way to call a server update??

mtboss124 avatar Oct 04 '24 00:10 mtboss124

the issue is that, the server gives 404 when requested the generated file even if its there. It only reads the file once the server is restarted

mtboss124 avatar Oct 04 '24 06:10 mtboss124

this is run on boot

https://github.com/pbsds/hatena-server/blob/master/hatena.py#L166

pbsds avatar Oct 04 '24 07:10 pbsds

Didn't catch that line, mb.

Will test updating it manually every time an ugomenu generates and post the results in a few hours when i get on pc

mtboss124 avatar Oct 04 '24 10:10 mtboss124

called the function after importing from hatena.py after some tests no problems happend. Thanks!!!

mtboss124 avatar Oct 04 '24 17:10 mtboss124

turns out the files where cached and it wasnt updating the files using this to update the code whenever it makes a request image

defined here (or imported) image it dosent give any errors but its still giving 404 until server restart

mtboss124 avatar Oct 04 '24 22:10 mtboss124

you may have to implement some getChild logic to dynamically traverse the files tree

pbsds avatar Oct 06 '24 23:10 pbsds

I see. i will try to implement it in the near future. Ill have to read more python stuff and see if can make it

mtboss124 avatar Oct 07 '24 05:10 mtboss124

even tho the code traverses the files and lists them in the console it refuses to update till the server restarts i have been trying, but i cant get it to work. maybe its possible to not serve static files to begin with??? (i am very unexpirienced with protocols)

mtboss124 avatar Oct 11 '24 07:10 mtboss124

how Twisted works is that each file or folder is represented with a class/object. Instead of attaching children to the root object at startup, you can override the getChild methods to do the traversal at the time a request happens.

pbsds avatar Oct 13 '24 23:10 pbsds

that is for example what happens here

https://github.com/pbsds/hatena-server/blob/master/hatena.py#L53C6-L53C14

pbsds avatar Oct 13 '24 23:10 pbsds