blob: f43ab09a9bf9ed27e478e30ebdbdea072d5da185 [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001# Copyright 2016 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style
3# license that can be found in the LICENSE file or at
4# https://developers.google.com/open-source/licenses/bsd
5
6"""Classes to handle cron requests to trim users' hotlists/issues visited."""
7from __future__ import print_function
8from __future__ import division
9from __future__ import absolute_import
10
11from framework import jsonfeed
12
Adrià Vilanova Martínezde942802022-07-15 14:06:55 +020013
Adrià Vilanova Martínez9f9ade52022-10-10 23:20:11 +020014class TrimVisitedPages(jsonfeed.FlaskInternalTask):
Copybara854996b2021-09-07 19:36:02 +000015
16 """Look for users with more than 10 visited hotlists and deletes extras."""
17
18 def HandleRequest(self, mr):
19 """Delete old RecentHotlist2User rows when there are too many"""
20 self.services.user.TrimUserVisitedHotlists(mr.cnxn)
Adrià Vilanova Martínezde942802022-07-15 14:06:55 +020021
Adrià Vilanova Martínez9f9ade52022-10-10 23:20:11 +020022 def GetTrimVisitedPages(self, **kwargs):
23 return self.handler(**kwargs)