Changeset 20 for TriviaEngine
- Timestamp:
- 10/08/06 09:40:20 (6 years ago)
- File:
-
- 1 edited
-
TriviaEngine/TriviaEngine-sqlite.tcl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
TriviaEngine/TriviaEngine-sqlite.tcl
r19 r20 1348 1348 proc trivia_watchdog { } { 1349 1349 #<<< 1350 global trivia_last_ts trivia_watchdog_timer trivia_status trivia_channel 1350 global trivia_last_ts trivia_watchdog_timer trivia_status trivia_channel trivia_delay trivia_speed 1351 1351 1352 1352 putloglev d * "trivia watchdog: tick" 1353 1353 1354 if {$trivia_last_ts == 0} { 1355 #never asked a question 1354 # slow down if we've never asked a question or we're stopped 1355 if {($trivia_last_ts == 0) || ($trivia_status == 0)} { 1356 putloglev 1 * "trivia is not running, slowing down watchdog" 1356 1357 set trivia_watchdog_timer [utimer 45 trivia_watchdog] 1357 1358 return 0 … … 1361 1362 set difference [expr $current_ts - $trivia_last_ts] 1362 1363 1363 if {$difference > 0} { 1364 set trivia_limit [expr $trivia_delay + $trivia_speed + 5] 1365 1366 putloglev 1 * "trivia watchdog: current: $current_ts, last: $trivia_last_ts, difference: $difference, max: $trivia_limit" 1367 1368 if {$difference > $trivia_limit} { 1364 1369 if {$trivia_status == 1} { 1365 1370 putlog "watchdog: trivia is broken" 1366 #putserv "PRIVMSG $trivia_channel :Oops, I think I'm broken. Attempting to recover..." 1367 #set trivia_status 0 1368 #trivia_start 1369 putlog "trivia watchdog: current: $current_ts, last: $trivia_last_ts, difference: $difference" 1370 } 1371 } 1371 putquick "PRIVMSG $trivia_channel :Oops, I think I'm broken. Attempting to recover..." 1372 set trivia_status 0 1373 trivia_start 1374 } 1375 } 1376 1377 set timer_interval [expr $trivia_delay * 2] 1372 1378 1373 1379 set trivia_watchdog_timer [utimer 10 trivia_watchdog] … … 1381 1387 global trivia_watchdog_timer 1382 1388 1383 if {$trivia_watchdog_timer != ""} { 1384 killutimer $trivia_watchdog_timer 1385 } 1389 set alltimers [utimers] 1390 foreach t $alltimers { 1391 putloglev 1 * "checking timer $t" 1392 set t_function [lindex $t 1] 1393 set t_name [lindex $t 2] 1394 set t_function [string tolower $t_function] 1395 if {$t_function == "trivia_watchdog"} { 1396 putloglev d * "killing timer $t_name" 1397 killutimer $t_name 1398 } 1399 } 1400 1401 unset trivia_watchdog_timer 1386 1402 } 1387 1403 #>>>
Note: See TracChangeset
for help on using the changeset viewer.
