default get pid
This commit is contained in:
parent
f30ecc41a2
commit
4e6b70cb94
8
logdb.go
8
logdb.go
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
|
@ -19,6 +20,7 @@ type LogDB struct {
|
|||
Port string `yaml:"port"`
|
||||
User string `yaml:"user"`
|
||||
|
||||
pid int
|
||||
hostid int
|
||||
nextCheck int64
|
||||
checkLimit int64
|
||||
|
@ -29,6 +31,7 @@ type LogDB struct {
|
|||
func New(filename string) *LogDB {
|
||||
logdb := LogDB{}
|
||||
logdb.checkLimit = 300
|
||||
logdb.pid = os.Getpid()
|
||||
|
||||
data, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
|
@ -108,10 +111,9 @@ type ADResonse struct {
|
|||
Response string
|
||||
}
|
||||
|
||||
func (logdb *LogDB) ADParserSelect(pid, spider_id int) []ADResonse {
|
||||
func (logdb *LogDB) ADParserSelect(spider_id int) []ADResonse {
|
||||
|
||||
// pid := os.Getpid() + 2000
|
||||
// spiderid := 73 + 1000000
|
||||
pid := logdb.pid + 2000
|
||||
logdb.ADCheckError(spider_id)
|
||||
|
||||
_, err := logdb.driver.Exec("update log_spider set status = ? where spider_id = ? and status = 0 limit 100", pid, spider_id)
|
||||
|
|
Loading…
Reference in New Issue
Block a user