mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
remove history items limit
This commit is contained in:
parent
cd9e786640
commit
846c488480
4 changed files with 7 additions and 14 deletions
|
|
@ -63,14 +63,13 @@ impl Memory {
|
|||
}
|
||||
|
||||
/// Get recent requests vector sorted by `ID` DESC
|
||||
pub fn recent(&self, limit: usize) -> Vec<String> {
|
||||
pub fn recent(&self) -> Vec<String> {
|
||||
let mut recent: Vec<String> = Vec::new();
|
||||
for (request, _) in self
|
||||
.index
|
||||
.borrow()
|
||||
.iter()
|
||||
.sorted_by(|a, b| Ord::cmp(&b.1, &a.1))
|
||||
.take(limit)
|
||||
{
|
||||
recent.push(request.to_string())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,14 +39,13 @@ impl Request {
|
|||
|
||||
/// Get recent requests vector
|
||||
/// * sorted by `unix_timestamp` DESC
|
||||
pub fn recent(&self, limit: usize) -> Vec<GString> {
|
||||
pub fn recent(&self) -> Vec<GString> {
|
||||
let mut recent: Vec<GString> = Vec::new();
|
||||
for (request, _) in self
|
||||
.index
|
||||
.borrow()
|
||||
.iter()
|
||||
.sorted_by(|a, b| Ord::cmp(&b.1.unix_timestamp, &a.1.unix_timestamp))
|
||||
.take(limit)
|
||||
{
|
||||
recent.push(request.clone())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,15 +39,14 @@ impl Tab {
|
|||
});
|
||||
}
|
||||
|
||||
/// Get recent `Item` vector sorted by time DESC
|
||||
pub fn recent(&self, limit: usize) -> Vec<Rc<Item>> {
|
||||
/// Get recent `Item` vector sorted by `unix_timestamp` DESC
|
||||
pub fn recent(&self) -> Vec<Rc<Item>> {
|
||||
let mut recent: Vec<Rc<Item>> = Vec::new();
|
||||
for record in self
|
||||
.index
|
||||
.borrow()
|
||||
.iter()
|
||||
.sorted_by(|a, b| Ord::cmp(&b.unix_timestamp, &a.unix_timestamp))
|
||||
.take(limit)
|
||||
{
|
||||
recent.push(record.item.clone())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue