more
This commit is contained in:
parent
c5479e2386
commit
7abd41eecd
@ -13,7 +13,7 @@ type CacheHandler interface {
|
||||
|
||||
type CacheInterface interface {
|
||||
RegenAll()
|
||||
RegenFrontPage()
|
||||
RegenFrontPage(pagesstart int)
|
||||
RegenOnModEvent(newsgroup, msgid, root string, page int)
|
||||
RegenerateBoard(group string)
|
||||
Regen(msg ArticleEntry)
|
||||
|
@ -145,7 +145,7 @@ func (self *FileCache) pollRegen() {
|
||||
// regen ukko
|
||||
case _ = <-self.ukkoTicker.C:
|
||||
self.regenUkko()
|
||||
self.RegenFrontPage()
|
||||
self.RegenFrontPage(0)
|
||||
case _ = <-self.regenThreadTicker.C:
|
||||
self.regenThreadLock.Lock()
|
||||
for _, entry := range self.regenThreadMap {
|
||||
@ -228,7 +228,7 @@ func (self *FileCache) regenerateCatalog(board string) {
|
||||
}
|
||||
|
||||
// regenerate the front page
|
||||
func (self *FileCache) RegenFrontPage() {
|
||||
func (self *FileCache) RegenFrontPage(_ int) {
|
||||
indexwr, err1 := os.Create(filepath.Join(self.webroot_dir, "index.html"))
|
||||
defer indexwr.Close()
|
||||
if err1 != nil {
|
||||
|
@ -228,7 +228,8 @@ func (self *httpFrontend) RegenerateBoard(board string) {
|
||||
}
|
||||
|
||||
func (self *httpFrontend) RegenFrontPage() {
|
||||
self.cache.RegenFrontPage()
|
||||
pages, _ := self.daemon.database.GetUkkoPageCount(10)
|
||||
self.cache.RegenFrontPage(int(pages))
|
||||
}
|
||||
|
||||
func (self httpFrontend) regenAll() {
|
||||
@ -367,7 +368,7 @@ func (self *httpFrontend) poll_liveui() {
|
||||
func (self *httpFrontend) poll() {
|
||||
|
||||
// regenerate front page
|
||||
self.cache.RegenFrontPage()
|
||||
self.RegenFrontPage()
|
||||
|
||||
// trigger regen
|
||||
if self.regen_on_start {
|
||||
|
@ -246,7 +246,7 @@ func (self *NullCache) DeleteThreadMarkup(root_post_id string) {
|
||||
func (self *NullCache) RegenAll() {
|
||||
}
|
||||
|
||||
func (self *NullCache) RegenFrontPage() {
|
||||
func (self *NullCache) RegenFrontPage(pagestart int) {
|
||||
}
|
||||
|
||||
func (self *NullCache) SetRequireCaptcha(required bool) {
|
||||
|
@ -82,20 +82,25 @@ func (self *VarnishCache) RegenAll() {
|
||||
}
|
||||
}
|
||||
|
||||
func (self *VarnishCache) RegenFrontPage() {
|
||||
func (self *VarnishCache) RegenFrontPage(pagestart int) {
|
||||
self.invalidate(fmt.Sprintf("%s%s", self.varnish_url, self.prefix))
|
||||
// TODO: this is also lazy af
|
||||
self.invalidate(fmt.Sprintf("%s%shistory.html", self.varnish_url, self.prefix))
|
||||
self.invalidateUkko(10)
|
||||
if self.handler.invertPagination {
|
||||
self.invalidateUkko(50, pagestart-50)
|
||||
} else {
|
||||
self.invalidateUkko(pagestart, 0)
|
||||
}
|
||||
}
|
||||
|
||||
func (self *VarnishCache) invalidateUkko(pages int) {
|
||||
func (self *VarnishCache) invalidateUkko(pages, start int) {
|
||||
self.invalidate(fmt.Sprintf("%s%sukko.html", self.varnish_url, self.prefix))
|
||||
self.invalidate(fmt.Sprintf("%s%so/", self.varnish_url, self.prefix))
|
||||
self.invalidate(fmt.Sprintf("%s%sukko.json", self.varnish_url, self.prefix))
|
||||
self.invalidate(fmt.Sprintf("%s%so/json", self.varnish_url, self.prefix))
|
||||
n := 0
|
||||
for n < pages {
|
||||
n := start
|
||||
end := start + pages
|
||||
for n < end {
|
||||
self.invalidate(fmt.Sprintf("%s%so/%d/json", self.varnish_url, self.prefix, n))
|
||||
self.invalidate(fmt.Sprintf("%s%so/%d/", self.varnish_url, self.prefix, n))
|
||||
n++
|
||||
|
Reference in New Issue
Block a user