forked from lichess-org/lila
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fishnet' into ios-push-rm-cursor-fishnet
* fishnet: fix duplicated logging on dev fishnet: proper transactional move handling use shared transactional memory for fishnet moves fishnet: in-memory move database for greater performances fishnet: request AI move on socket connection fishnet: average analysis evaluation stats before kamon show analysis in progress on analysis page fishnet: monitor acquirement improve wsmonitor fishnet: refine types fishnet: only monitor client play movetime on level 8 fishnet: stop monitoring offline clients only monitor fishnet on stage [REVERT ME] more fishnet monitoring improvement don't block the future sequencer! {fishnet} parse only what's required for the current request monitor fishnet analysis engine hash size and threads
- Loading branch information
Showing
14 changed files
with
118 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package lila.fishnet | ||
|
||
import scala.concurrent.stm._ | ||
|
||
private final class MoveDB { | ||
|
||
import Work.Move | ||
|
||
private val maxSize = 1000 | ||
|
||
type CollType = TMap[Work.Id, Move] | ||
|
||
private val coll: CollType = TMap.empty | ||
|
||
def get = coll.single.get _ | ||
|
||
def add(move: Move)(implicit txn: InTxn): Unit = | ||
if (coll.size < maxSize) coll.put(move.id, move) | ||
|
||
def update(move: Move)(implicit tnx: InTxn): Unit = | ||
if (coll.contains(move.id)) coll.put(move.id, move) | ||
|
||
def delete(move: Move)(implicit tnx: InTxn): Unit = | ||
coll.remove(move.id) | ||
|
||
def transaction[A](f: InTxn => A): A = atomic { txn => | ||
f(txn) | ||
} | ||
|
||
def contains = coll.single.contains _ | ||
|
||
def exists = coll.single.values.exists _ | ||
|
||
def find = coll.single.values.filter _ | ||
|
||
def count = coll.single.values.count _ | ||
|
||
def size = coll.single.size | ||
|
||
def updateOrGiveUp(move: Move) = transaction { implicit txn => | ||
if (move.isOutOfTries) { | ||
log.warn(s"Give up on move $move") | ||
delete(move) | ||
} | ||
else update(move) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.