4chan / 4chan-API

Documentation for 4chan's read-only JSON API.
http://www.4chan.org/
1.02k stars 73 forks source link

Archived threads sort order #72

Closed chairus closed 4 years ago

chairus commented 4 years ago

Can we safely assume that the returned IDs for the archived threads endpoint is ordered by the time they were posted? Or can we assume that thread IDs are sequential? It looks like the returned IDs is sorted in ascending order, which matches with the time they were posted.

desuwa commented 4 years ago

Yes, threads are ordered by thread ID.

chairus commented 4 years ago

@desuwa Can we safely assume that the returned IDs are ordered by the time they were posted?

desuwa commented 4 years ago

Yes, threads are ordered by thread ID in ascending order, which matches with the time they were posted. Or is there a bug or something?

chairus commented 4 years ago

I think so, consider the archived threads for the /pol/ board, the response contains the two IDs: 225690368 and 225681535 and they were posted 09/06/19(Fri)14:40:59 and 09/06/19(Fri)14:42:56 respectively, but the former didn't immediately follow the latter in the response, the latter was followed by this ID 225681677 which has a post time of 09/06/19(Fri)14:44:30 (which is clearly later than 09/06/19(Fri)14:42:56), that's why I am curious if the thread IDs were ordered by the time they were posted.

chairus commented 4 years ago

It seems like the API endpoint is returning thread IDs that has already been deleted. When I made a second request to get the archived threads a couple of mins. after I made the first request from my previous comment above, the thread ID 225690368 is not in the list anymore, and it seems like it has already been deleted. Looks like the state of the thread ID hasn't propagated yet into the archived threads endpoint when I made my first request.

desuwa commented 4 years ago

Yes there's a bit of delay between updates.

Everything is fine then? I can't really check anymore as both threads are pruned now.

chairus commented 4 years ago

Yeah it seems like everything is fine now. Is there a way though to make sure we get the most up-to-date response from the archive threads endpoint?

desuwa commented 4 years ago

Is there a way though to make sure we get the most up-to-date response from the archive threads endpoint

It is up to date for all intents and purposes.

chairus commented 4 years ago

@desuwa Thanks

chairus commented 4 years ago

@desuwa I'm just curious what will happen if you ran out of IDs? The threadIds are positive integers and therefore there is an upper limit on the total number of IDs.

bakugo commented 4 years ago

@chairus Assuming an unsigned int is used to store post IDs in SQL right now, the limit is over 4 billion, and none of the boards have even reached 1 billion yet, so it's not really a problem. Even if that 4 billion limit is eventually reached, it can easily be changed to bigint, making the limit ridiculously large.